]> err.no Git - linux-2.6/blobdiff - fs/gfs2/daemon.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/mfasheh...
[linux-2.6] / fs / gfs2 / daemon.c
index a2a07c41845d414c6ac3a6362e2a5c77cf1db203..683cb5bda870fc372e79500c105ddf16c9ab93b9 100644 (file)
@@ -15,9 +15,9 @@
 #include <linux/kthread.h>
 #include <linux/delay.h>
 #include <linux/gfs2_ondisk.h>
+#include <linux/lm_interface.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "daemon.h"
 #include "glock.h"
@@ -30,7 +30,7 @@
 /* This uses schedule_timeout() instead of msleep() because it's good for
    the daemons to wake up more often than the timeout when unmounting so
    the user's unmount doesn't sit there forever.
-   
+
    The kthread functions used to start these daemons block and flush signals. */
 
 /**
@@ -112,6 +112,7 @@ int gfs2_logd(void *data)
        struct gfs2_sbd *sdp = data;
        struct gfs2_holder ji_gh;
        unsigned long t;
+       int need_flush;
 
        while (!kthread_should_stop()) {
                /* Advance the log tail */
@@ -120,8 +121,10 @@ int gfs2_logd(void *data)
                    gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
 
                gfs2_ail1_empty(sdp, DIO_ALL);
-
-               if (time_after_eq(jiffies, t)) {
+               gfs2_log_lock(sdp);
+               need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks);
+               gfs2_log_unlock(sdp);
+               if (need_flush || time_after_eq(jiffies, t)) {
                        gfs2_log_flush(sdp, NULL);
                        sdp->sd_log_flush_time = jiffies;
                }