diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-11-09 11:01:41 +0100 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-01-25 09:07:56 +0100 |
commit | ec69b188837a347769e187997d040e84a683b38a (patch) | |
tree | d16ebc9b83807f99a114efe3a093315f9839b81c /fs/gfs2/log.c | |
parent | [GFS2] Use atomic_t for journal free blocks counter (diff) | |
download | linux-ec69b188837a347769e187997d040e84a683b38a.tar.xz linux-ec69b188837a347769e187997d040e84a683b38a.zip |
[GFS2] Move gfs2_logd into log.c
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>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r-- | fs/gfs2/log.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 9192398408f2..e88a684b2209 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -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; +} + |