aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r--fs/gfs2/log.c56
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 @@
16#include <linux/crc32.h> 16#include <linux/crc32.h>
17#include <linux/lm_interface.h> 17#include <linux/lm_interface.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/kthread.h>
20#include <linux/freezer.h>
19 21
20#include "gfs2.h" 22#include "gfs2.h"
21#include "incore.h" 23#include "incore.h"
@@ -26,6 +28,7 @@
26#include "meta_io.h" 28#include "meta_io.h"
27#include "util.h" 29#include "util.h"
28#include "dir.h" 30#include "dir.h"
31#include "super.h"
29 32
30#define PULL 1 33#define PULL 1
31 34
@@ -208,7 +211,7 @@ static void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags)
208 gfs2_log_unlock(sdp); 211 gfs2_log_unlock(sdp);
209} 212}
210 213
211int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags) 214static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags)
212{ 215{
213 struct gfs2_ail *ai, *s; 216 struct gfs2_ail *ai, *s;
214 int ret; 217 int ret;
@@ -859,3 +862,54 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
859 } 862 }
860} 863}
861 864
865
866/**
867 * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks
868 * @sdp: Pointer to GFS2 superblock
869 *
870 * Also, periodically check to make sure that we're using the most recent
871 * journal index.
872 */
873
874int gfs2_logd(void *data)
875{
876 struct gfs2_sbd *sdp = data;
877 struct gfs2_holder ji_gh;
878 unsigned long t;
879 int need_flush;
880
881 while (!kthread_should_stop()) {
882 /* Advance the log tail */
883
884 t = sdp->sd_log_flush_time +
885 gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
886
887 gfs2_ail1_empty(sdp, DIO_ALL);
888 gfs2_log_lock(sdp);
889 need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks);
890 gfs2_log_unlock(sdp);
891 if (need_flush || time_after_eq(jiffies, t)) {
892 gfs2_log_flush(sdp, NULL);
893 sdp->sd_log_flush_time = jiffies;
894 }
895
896 /* Check for latest journal index */
897
898 t = sdp->sd_jindex_refresh_time +
899 gfs2_tune_get(sdp, gt_jindex_refresh_secs) * HZ;
900
901 if (time_after_eq(jiffies, t)) {
902 if (!gfs2_jindex_hold(sdp, &ji_gh))
903 gfs2_glock_dq_uninit(&ji_gh);
904 sdp->sd_jindex_refresh_time = jiffies;
905 }
906
907 t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
908 if (freezing(current))
909 refrigerator();
910 schedule_timeout_interruptible(t);
911 }
912
913 return 0;
914}
915