aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);