[GFS2] Move gfs2_logd into log.c
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 9 Nov 2007 10:01:41 +0000 (10:01 +0000)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 25 Jan 2008 08:07:56 +0000 (08:07 +0000)
This means that we can mark gfs2_ail1_empty static and prepares
the way for further changes.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/daemon.c
fs/gfs2/daemon.h
fs/gfs2/log.c
fs/gfs2/log.h

index 3731ab0771d511ada7a2e6fbfceecb174b4075ee..e51991947d2cd876c39ba4eea0d8b6b31c838ebe 100644 (file)
@@ -82,56 +82,6 @@ int gfs2_recoverd(void *data)
        return 0;
 }
 
-/**
- * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks
- * @sdp: Pointer to GFS2 superblock
- *
- * Also, periodically check to make sure that we're using the most recent
- * journal index.
- */
-
-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 */
-
-               t = sdp->sd_log_flush_time +
-                   gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
-
-               gfs2_ail1_empty(sdp, DIO_ALL);
-               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;
-               }
-
-               /* Check for latest journal index */
-
-               t = sdp->sd_jindex_refresh_time +
-                   gfs2_tune_get(sdp, gt_jindex_refresh_secs) * HZ;
-
-               if (time_after_eq(jiffies, t)) {
-                       if (!gfs2_jindex_hold(sdp, &ji_gh))
-                               gfs2_glock_dq_uninit(&ji_gh);
-                       sdp->sd_jindex_refresh_time = jiffies;
-               }
-
-               t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
-               if (freezing(current))
-                       refrigerator();
-               schedule_timeout_interruptible(t);
-       }
-
-       return 0;
-}
-
 /**
  * gfs2_quotad - Write cached quota changes into the quota file
  * @sdp: Pointer to GFS2 superblock
index 0de9b35579555dcaabf74378bd6ee7fc465d971b..4be084fb6a6219356d691e7e857805458005fe5b 100644 (file)
@@ -12,7 +12,6 @@
 
 int gfs2_glockd(void *data);
 int gfs2_recoverd(void *data);
-int gfs2_logd(void *data);
 int gfs2_quotad(void *data);
 
 #endif /* __DAEMON_DOT_H__ */
index 9192398408f239db4845e12e23c39e5141af87ba..e88a684b2209cd8a3eed7454b3e1cf882184e6e8 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/crc32.h>
 #include <linux/lm_interface.h>
 #include <linux/delay.h>
+#include <linux/kthread.h>
+#include <linux/freezer.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -26,6 +28,7 @@
 #include "meta_io.h"
 #include "util.h"
 #include "dir.h"
+#include "super.h"
 
 #define PULL 1
 
@@ -208,7 +211,7 @@ static void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags)
        gfs2_log_unlock(sdp);
 }
 
-int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
+static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
 {
        struct gfs2_ail *ai, *s;
        int ret;
@@ -859,3 +862,54 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
        }
 }
 
+
+/**
+ * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks
+ * @sdp: Pointer to GFS2 superblock
+ *
+ * Also, periodically check to make sure that we're using the most recent
+ * journal index.
+ */
+
+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 */
+
+               t = sdp->sd_log_flush_time +
+                   gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
+
+               gfs2_ail1_empty(sdp, DIO_ALL);
+               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;
+               }
+
+               /* Check for latest journal index */
+
+               t = sdp->sd_jindex_refresh_time +
+                   gfs2_tune_get(sdp, gt_jindex_refresh_secs) * HZ;
+
+               if (time_after_eq(jiffies, t)) {
+                       if (!gfs2_jindex_hold(sdp, &ji_gh))
+                               gfs2_glock_dq_uninit(&ji_gh);
+                       sdp->sd_jindex_refresh_time = jiffies;
+               }
+
+               t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
+               if (freezing(current))
+                       refrigerator();
+               schedule_timeout_interruptible(t);
+       }
+
+       return 0;
+}
+
index 4babd430b72224ce239ed9a8d4d1679845bd2a79..7711528165088002a3601de4c57ef101eae755ba 100644 (file)
@@ -48,8 +48,6 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
 unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
                            unsigned int ssize);
 
-int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags);
-
 int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks);
 void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
 void gfs2_log_incr_head(struct gfs2_sbd *sdp);
@@ -70,5 +68,6 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd);
 
 void gfs2_log_shutdown(struct gfs2_sbd *sdp);
 void gfs2_meta_syncfs(struct gfs2_sbd *sdp);
+int gfs2_logd(void *data);
 
 #endif /* __LOG_DOT_H__ */