Merge master.kernel.org:/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.git] / fs / gfs2 / daemon.c
index 9e7b9f2..683cb5b 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"
 #include "quota.h"
 #include "recovery.h"
 #include "super.h"
-#include "unlinked.h"
 #include "util.h"
 
 /* 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. */
 
 /**
@@ -113,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 */
@@ -121,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;
                }
@@ -195,29 +197,3 @@ int gfs2_quotad(void *data)
        return 0;
 }
 
-/**
- * gfs2_inoded - Deallocate unlinked inodes
- * @sdp: Pointer to GFS2 superblock
- *
- */
-
-int gfs2_inoded(void *data)
-{
-       struct gfs2_sbd *sdp = data;
-       unsigned long t;
-       int error;
-
-       while (!kthread_should_stop()) {
-               error = gfs2_unlinked_dealloc(sdp);
-               if (error &&
-                   error != -EROFS &&
-                   !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-                       fs_err(sdp, "inoded: error = %d\n", error);
-
-               t = gfs2_tune_get(sdp, gt_inoded_secs) * HZ;
-               schedule_timeout_interruptible(t);
-       }
-
-       return 0;
-}
-