aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2007-11-09 05:01:41 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2008-01-25 03:07:56 -0500
commitec69b188837a347769e187997d040e84a683b38a (patch)
treed16ebc9b83807f99a114efe3a093315f9839b81c /fs/gfs2
parentfd041f0b4045db8646b36d393cbb274db60649f5 (diff)
[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')
-rw-r--r--fs/gfs2/daemon.c50
-rw-r--r--fs/gfs2/daemon.h1
-rw-r--r--fs/gfs2/log.c56
-rw-r--r--fs/gfs2/log.h3
4 files changed, 56 insertions, 54 deletions
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
index 3731ab0771d..e51991947d2 100644
--- a/fs/gfs2/daemon.c
+++ b/fs/gfs2/daemon.c
@@ -83,56 +83,6 @@ int gfs2_recoverd(void *data)
83} 83}
84 84
85/** 85/**
86 * gfs2_logd - Update log tail as Active Items get flushed to in-place blocks
87 * @sdp: Pointer to GFS2 superblock
88 *
89 * Also, periodically check to make sure that we're using the most recent
90 * journal index.
91 */
92
93int gfs2_logd(void *data)
94{
95 struct gfs2_sbd *sdp = data;
96 struct gfs2_holder ji_gh;
97 unsigned long t;
98 int need_flush;
99
100 while (!kthread_should_stop()) {
101 /* Advance the log tail */
102
103 t = sdp->sd_log_flush_time +
104 gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
105
106 gfs2_ail1_empty(sdp, DIO_ALL);
107 gfs2_log_lock(sdp);
108 need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks);
109 gfs2_log_unlock(sdp);
110 if (need_flush || time_after_eq(jiffies, t)) {
111 gfs2_log_flush(sdp, NULL);
112 sdp->sd_log_flush_time = jiffies;
113 }
114
115 /* Check for latest journal index */
116
117 t = sdp->sd_jindex_refresh_time +
118 gfs2_tune_get(sdp, gt_jindex_refresh_secs) * HZ;
119
120 if (time_after_eq(jiffies, t)) {
121 if (!gfs2_jindex_hold(sdp, &ji_gh))
122 gfs2_glock_dq_uninit(&ji_gh);
123 sdp->sd_jindex_refresh_time = jiffies;
124 }
125
126 t = gfs2_tune_get(sdp, gt_logd_secs) * HZ;
127 if (freezing(current))
128 refrigerator();
129 schedule_timeout_interruptible(t);
130 }
131
132 return 0;
133}
134
135/**
136 * gfs2_quotad - Write cached quota changes into the quota file 86 * gfs2_quotad - Write cached quota changes into the quota file
137 * @sdp: Pointer to GFS2 superblock 87 * @sdp: Pointer to GFS2 superblock
138 * 88 *
diff --git a/fs/gfs2/daemon.h b/fs/gfs2/daemon.h
index 0de9b355795..4be084fb6a6 100644
--- a/fs/gfs2/daemon.h
+++ b/fs/gfs2/daemon.h
@@ -12,7 +12,6 @@
12 12
13int gfs2_glockd(void *data); 13int gfs2_glockd(void *data);
14int gfs2_recoverd(void *data); 14int gfs2_recoverd(void *data);
15int gfs2_logd(void *data);
16int gfs2_quotad(void *data); 15int gfs2_quotad(void *data);
17 16
18#endif /* __DAEMON_DOT_H__ */ 17#endif /* __DAEMON_DOT_H__ */
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 9192398408f..e88a684b220 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
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h
index 4babd430b72..77115281650 100644
--- a/fs/gfs2/log.h
+++ b/fs/gfs2/log.h
@@ -48,8 +48,6 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
48unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, 48unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
49 unsigned int ssize); 49 unsigned int ssize);
50 50
51int gfs2_ail1_empty(struct gfs2_sbd *sdp, int flags);
52
53int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks); 51int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks);
54void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); 52void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
55void gfs2_log_incr_head(struct gfs2_sbd *sdp); 53void gfs2_log_incr_head(struct gfs2_sbd *sdp);
@@ -70,5 +68,6 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd);
70 68
71void gfs2_log_shutdown(struct gfs2_sbd *sdp); 69void gfs2_log_shutdown(struct gfs2_sbd *sdp);
72void gfs2_meta_syncfs(struct gfs2_sbd *sdp); 70void gfs2_meta_syncfs(struct gfs2_sbd *sdp);
71int gfs2_logd(void *data);
73 72
74#endif /* __LOG_DOT_H__ */ 73#endif /* __LOG_DOT_H__ */