aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-06-25 11:30:26 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2009-07-30 05:52:14 -0400
commit2163b1e616c41c286f5ab79912671cd4bf52057c (patch)
tree5f7170d724c69e0f51857367b5de5a2c0e9bdbae /fs
parent4be3bd7849165e7efa6b0b35a23d6a3598d97465 (diff)
GFS2: Shrink the shrinker
This patch removes some of the special cases that the shrinker was trying to deal with. As a result we leave fewer items on the list and none at all which cannot be demoted. This makes the list scanning more efficient and solves some issues seen with large numbers of inodes. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/glock.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 297421c0427a..fdb796c4f940 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1300,7 +1300,6 @@ static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
1300 struct gfs2_glock *gl; 1300 struct gfs2_glock *gl;
1301 int may_demote; 1301 int may_demote;
1302 int nr_skipped = 0; 1302 int nr_skipped = 0;
1303 int got_ref = 0;
1304 LIST_HEAD(skipped); 1303 LIST_HEAD(skipped);
1305 1304
1306 if (nr == 0) 1305 if (nr == 0)
@@ -1318,7 +1317,6 @@ static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
1318 /* Test for being demotable */ 1317 /* Test for being demotable */
1319 if (!test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { 1318 if (!test_and_set_bit(GLF_LOCK, &gl->gl_flags)) {
1320 gfs2_glock_hold(gl); 1319 gfs2_glock_hold(gl);
1321 got_ref = 1;
1322 spin_unlock(&lru_lock); 1320 spin_unlock(&lru_lock);
1323 spin_lock(&gl->gl_spin); 1321 spin_lock(&gl->gl_spin);
1324 may_demote = demote_ok(gl); 1322 may_demote = demote_ok(gl);
@@ -1327,25 +1325,14 @@ static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
1327 if (may_demote) { 1325 if (may_demote) {
1328 handle_callback(gl, LM_ST_UNLOCKED, 0); 1326 handle_callback(gl, LM_ST_UNLOCKED, 0);
1329 nr--; 1327 nr--;
1330 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1331 gfs2_glock_put(gl);
1332 got_ref = 0;
1333 } 1328 }
1329 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1330 gfs2_glock_put(gl);
1334 spin_lock(&lru_lock); 1331 spin_lock(&lru_lock);
1335 if (may_demote) 1332 continue;
1336 continue;
1337 }
1338 if (list_empty(&gl->gl_lru) &&
1339 (atomic_read(&gl->gl_ref) <= (2 + got_ref))) {
1340 nr_skipped++;
1341 list_add(&gl->gl_lru, &skipped);
1342 }
1343 if (got_ref) {
1344 spin_unlock(&lru_lock);
1345 gfs2_glock_put(gl);
1346 spin_lock(&lru_lock);
1347 got_ref = 0;
1348 } 1333 }
1334 nr_skipped++;
1335 list_add(&gl->gl_lru, &skipped);
1349 } 1336 }
1350 list_splice(&skipped, &lru_list); 1337 list_splice(&skipped, &lru_list);
1351 atomic_add(nr_skipped, &lru_count); 1338 atomic_add(nr_skipped, &lru_count);