aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glops.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2008-11-20 08:39:47 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2009-01-05 02:39:09 -0500
commit97cc1025b1a91c52e84f12478dcf0f853abc6564 (patch)
treecd71419049aeb13eea7012889d0ee0c715394e4d /fs/gfs2/glops.c
parent9ac1b4d9b6f885ccd7d8f56bceb609003a920ff7 (diff)
GFS2: Kill two daemons with one patch
This patch removes the two daemons, gfs2_scand and gfs2_glockd and replaces them with a shrinker which is called from the VM. The net result is that GFS2 responds better when there is memory pressure, since it shrinks the glock cache at the same rate as the VFS shrinks the dcache and icache. There are no longer any time based criteria for shrinking glocks, they are kept until such time as the VM asks for more memory and then we demote just as many glocks as required. There are potential future changes to this code, including the possibility of sorting the glocks which are to be written back into inode number order, to get a better I/O ordering. It would be very useful to have an elevator based workqueue implementation for this, as that would automatically deal with the read I/O cases at the same time. This patch is my answer to Andrew Morton's remark, made during the initial review of GFS2, asking why GFS2 needs so many kernel threads, the answer being that it doesn't :-) This patch is a net loss of about 200 lines of code. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glops.c')
-rw-r--r--fs/gfs2/glops.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 8ebff8ebae20..8522d3aa64fc 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -201,19 +201,12 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
201 * Returns: 1 if it's ok 201 * Returns: 1 if it's ok
202 */ 202 */
203 203
204static int inode_go_demote_ok(struct gfs2_glock *gl) 204static int inode_go_demote_ok(const struct gfs2_glock *gl)
205{ 205{
206 struct gfs2_sbd *sdp = gl->gl_sbd; 206 struct gfs2_sbd *sdp = gl->gl_sbd;
207 int demote = 0; 207 if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object)
208 208 return 0;
209 if (!gl->gl_object && !gl->gl_aspace->i_mapping->nrpages) 209 return 1;
210 demote = 1;
211 else if (!sdp->sd_args.ar_localcaching &&
212 time_after_eq(jiffies, gl->gl_stamp +
213 gfs2_tune_get(sdp, gt_demote_secs) * HZ))
214 demote = 1;
215
216 return demote;
217} 210}
218 211
219/** 212/**
@@ -284,7 +277,7 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
284 * Returns: 1 if it's ok 277 * Returns: 1 if it's ok
285 */ 278 */
286 279
287static int rgrp_go_demote_ok(struct gfs2_glock *gl) 280static int rgrp_go_demote_ok(const struct gfs2_glock *gl)
288{ 281{
289 return !gl->gl_aspace->i_mapping->nrpages; 282 return !gl->gl_aspace->i_mapping->nrpages;
290} 283}
@@ -386,13 +379,25 @@ static int trans_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
386} 379}
387 380
388/** 381/**
382 * trans_go_demote_ok
383 * @gl: the glock
384 *
385 * Always returns 0
386 */
387
388static int trans_go_demote_ok(const struct gfs2_glock *gl)
389{
390 return 0;
391}
392
393/**
389 * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock 394 * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock
390 * @gl: the glock 395 * @gl: the glock
391 * 396 *
392 * Returns: 1 if it's ok 397 * Returns: 1 if it's ok
393 */ 398 */
394 399
395static int quota_go_demote_ok(struct gfs2_glock *gl) 400static int quota_go_demote_ok(const struct gfs2_glock *gl)
396{ 401{
397 return !atomic_read(&gl->gl_lvb_count); 402 return !atomic_read(&gl->gl_lvb_count);
398} 403}
@@ -426,6 +431,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
426const struct gfs2_glock_operations gfs2_trans_glops = { 431const struct gfs2_glock_operations gfs2_trans_glops = {
427 .go_xmote_th = trans_go_sync, 432 .go_xmote_th = trans_go_sync,
428 .go_xmote_bh = trans_go_xmote_bh, 433 .go_xmote_bh = trans_go_xmote_bh,
434 .go_demote_ok = trans_go_demote_ok,
429 .go_type = LM_TYPE_NONDISK, 435 .go_type = LM_TYPE_NONDISK,
430}; 436};
431 437