aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/daemon.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-11-23 10:51:34 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-11-30 10:36:42 -0500
commitb004157ab5b374a498a5874cda68c389219d23e7 (patch)
tree1e7d7d5c62f3e12cc453e763bbff139b47458be4 /fs/gfs2/daemon.c
parentae619320b22f8e0b2bbe4a3a5ac2f9ccf08d7ec2 (diff)
[GFS2] Fix journal flush problem
This fixes a bug which resulted in poor performance due to flushing the journal too often. The code path in question was via the inode_go_sync() function in glops.c. The solution is not to flush the journal immediately when inodes are ejected from memory, but batch up the work for glockd to deal with later on. This means that glocks may now live on beyond the end of the lifetime of their inodes (but not very much longer in the normal case). Also fixed in this patch is a bug (which was hidden by the bug mentioned above) in calculation of the number of free journal blocks. The gfs2_logd process has been altered to be more responsive to the journal filling up. We now wake it up when the number of uncommitted journal blocks has reached the threshold level rather than trying to flush directly at the end of each transaction. This again means doing fewer, but larger, log flushes in general. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/daemon.c')
-rw-r--r--fs/gfs2/daemon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
index cab1f68d4685..683cb5bda870 100644
--- a/fs/gfs2/daemon.c
+++ b/fs/gfs2/daemon.c
@@ -112,6 +112,7 @@ int gfs2_logd(void *data)
112 struct gfs2_sbd *sdp = data; 112 struct gfs2_sbd *sdp = data;
113 struct gfs2_holder ji_gh; 113 struct gfs2_holder ji_gh;
114 unsigned long t; 114 unsigned long t;
115 int need_flush;
115 116
116 while (!kthread_should_stop()) { 117 while (!kthread_should_stop()) {
117 /* Advance the log tail */ 118 /* Advance the log tail */
@@ -120,8 +121,10 @@ int gfs2_logd(void *data)
120 gfs2_tune_get(sdp, gt_log_flush_secs) * HZ; 121 gfs2_tune_get(sdp, gt_log_flush_secs) * HZ;
121 122
122 gfs2_ail1_empty(sdp, DIO_ALL); 123 gfs2_ail1_empty(sdp, DIO_ALL);
123 124 gfs2_log_lock(sdp);
124 if (time_after_eq(jiffies, t)) { 125 need_flush = sdp->sd_log_num_buf > gfs2_tune_get(sdp, gt_incore_log_blocks);
126 gfs2_log_unlock(sdp);
127 if (need_flush || time_after_eq(jiffies, t)) {
125 gfs2_log_flush(sdp, NULL); 128 gfs2_log_flush(sdp, NULL);
126 sdp->sd_log_flush_time = jiffies; 129 sdp->sd_log_flush_time = jiffies;
127 } 130 }