]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/daemon.c
[AFS]: Handle multiple mounts of an AFS superblock correctly.
[linux-2.6-omap-h63xx.git] / fs / gfs2 / daemon.c
index 1453605c8f32d8be42f224dd7fb8477bdd6c5bbf..683cb5bda870fc372e79500c105ddf16c9ab93b9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License v.2.
+ * of the GNU General Public License version 2.
  */
 
 #include <linux/sched.h>
@@ -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;
                }