]> err.no Git - linux-2.6/blobdiff - fs/xfs/xfs_log.c
[XFS] choose single default logbuf count & size
[linux-2.6] / fs / xfs / xfs_log.c
index 9d4c4fbeb3ee2cf4618dd756f2e256760b8f158b..4f4d20b2721c323fc349ce8219344597f60ee064 100644 (file)
@@ -948,6 +948,19 @@ xlog_iodone(xfs_buf_t *bp)
         */
        l = iclog->ic_log;
 
+       /*
+        * If the ordered flag has been removed by a lower
+        * layer, it means the underlyin device no longer supports
+        * barrier I/O. Warn loudly and turn off barriers.
+        */
+       if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) {
+               l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
+               xfs_fs_cmn_err(CE_WARN, l->l_mp,
+                               "xlog_iodone: Barriers are no longer supported"
+                               " by device. Disabling barriers\n");
+               xfs_buftrace("XLOG_IODONE BARRIERS OFF", bp);
+       }
+
        /*
         * Race to shutdown the filesystem if we see an error.
         */
@@ -1012,10 +1025,7 @@ xlog_bdstrat_cb(struct xfs_buf *bp)
 /*
  * Return size of each in-core log record buffer.
  *
- * Low memory machines only get 2 16KB buffers.  We don't want to waste
- * memory here.  However, all other machines get at least 2 32KB buffers.
- * The number is hard coded because we don't care about the minimum
- * memory size, just 32MB systems.
+ * All machines get 8 x 32KB buffers by default, unless tuned otherwise.
  *
  * If the filesystem blocksize is too large, we may need to choose a
  * larger size since the directory code currently logs entire blocks.
@@ -1028,17 +1038,10 @@ xlog_get_iclog_buffer_size(xfs_mount_t  *mp,
        int size;
        int xhdrs;
 
-       if (mp->m_logbufs <= 0) {
-               if (xfs_physmem <= btoc(128*1024*1024)) {
-                       log->l_iclog_bufs = XLOG_MIN_ICLOGS;
-               } else if (xfs_physmem <= btoc(400*1024*1024)) {
-                       log->l_iclog_bufs = XLOG_MED_ICLOGS;
-               } else {        /* 256K with 32K bufs */
-                       log->l_iclog_bufs = XLOG_MAX_ICLOGS;
-               }
-       } else {
+       if (mp->m_logbufs <= 0)
+               log->l_iclog_bufs = XLOG_MAX_ICLOGS;
+       else
                log->l_iclog_bufs = mp->m_logbufs;
-       }
 
        /*
         * Buffer size passed in from mount system call.
@@ -1069,18 +1072,9 @@ xlog_get_iclog_buffer_size(xfs_mount_t   *mp,
                goto done;
        }
 
-       /*
-        * Special case machines that have less than 32MB of memory.
-        * All machines with more memory use 32KB buffers.
-        */
-       if (xfs_physmem <= btoc(32*1024*1024)) {
-               /* Don't change; min configuration */
-               log->l_iclog_size = XLOG_RECORD_BSIZE;          /* 16k */
-               log->l_iclog_size_log = XLOG_RECORD_BSHIFT;
-       } else {
-               log->l_iclog_size = XLOG_BIG_RECORD_BSIZE;      /* 32k */
-               log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT;
-       }
+       /* All machines use 32KB buffers by default. */
+       log->l_iclog_size = XLOG_BIG_RECORD_BSIZE;
+       log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT;
 
        /* the default log size is 16k or 32k which is one header sector */
        log->l_iclog_hsize = BBSIZE;
@@ -2185,13 +2179,13 @@ xlog_state_do_callback(
                        }
                        cb = iclog->ic_callback;
 
-                       while (cb != 0) {
+                       while (cb) {
                                iclog->ic_callback_tail = &(iclog->ic_callback);
                                iclog->ic_callback = NULL;
                                LOG_UNLOCK(log, s);
 
                                /* perform callbacks in the order given */
-                               for (; cb != 0; cb = cb_next) {
+                               for (; cb; cb = cb_next) {
                                        cb_next = cb->cb_next;
                                        cb->cb_func(cb->cb_arg, aborted);
                                }
@@ -2202,7 +2196,7 @@ xlog_state_do_callback(
                        loopdidcallbacks++;
                        funcdidcallbacks++;
 
-                       ASSERT(iclog->ic_callback == 0);
+                       ASSERT(iclog->ic_callback == NULL);
                        if (!(iclog->ic_state & XLOG_STATE_IOERROR))
                                iclog->ic_state = XLOG_STATE_DIRTY;
 
@@ -3242,10 +3236,10 @@ xlog_ticket_put(xlog_t          *log,
 #else
        /* When we debug, it is easier if tickets are cycled */
        ticket->t_next     = NULL;
-       if (log->l_tail != 0) {
+       if (log->l_tail) {
                log->l_tail->t_next = ticket;
        } else {
-               ASSERT(log->l_freelist == 0);
+               ASSERT(log->l_freelist == NULL);
                log->l_freelist = ticket;
        }
        log->l_tail         = ticket;
@@ -3463,7 +3457,7 @@ xlog_verify_iclog(xlog_t   *log,
        s = LOG_LOCK(log);
        icptr = log->l_iclog;
        for (i=0; i < log->l_iclog_bufs; i++) {
-               if (icptr == 0)
+               if (icptr == NULL)
                        xlog_panic("xlog_verify_iclog: invalid ptr");
                icptr = icptr->ic_next;
        }