glock.c (f90e5b5b136ede1f0fd15999e95f13124d6b0dbd) glock.c (1495f230fa7750479c79e3656286b9183d662077)
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */

--- 649 unchanged lines hidden (view full) ---

658 struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_work.work);
659 int drop_ref = 0;
660
661 if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) {
662 finish_xmote(gl, gl->gl_reply);
663 drop_ref = 1;
664 }
665 spin_lock(&gl->gl_spin);
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */

--- 649 unchanged lines hidden (view full) ---

658 struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_work.work);
659 int drop_ref = 0;
660
661 if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) {
662 finish_xmote(gl, gl->gl_reply);
663 drop_ref = 1;
664 }
665 spin_lock(&gl->gl_spin);
666 if (test_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
666 if (test_and_clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags) &&
667 gl->gl_state != LM_ST_UNLOCKED &&
668 gl->gl_demote_state != LM_ST_EXCLUSIVE) {
669 unsigned long holdtime, now = jiffies;
667 gl->gl_state != LM_ST_UNLOCKED &&
668 gl->gl_demote_state != LM_ST_EXCLUSIVE) {
669 unsigned long holdtime, now = jiffies;
670
671 holdtime = gl->gl_tchange + gl->gl_ops->go_min_hold_time;
672 if (time_before(now, holdtime))
673 delay = holdtime - now;
670 holdtime = gl->gl_tchange + gl->gl_ops->go_min_hold_time;
671 if (time_before(now, holdtime))
672 delay = holdtime - now;
674
675 if (!delay) {
676 clear_bit(GLF_PENDING_DEMOTE, &gl->gl_flags);
677 set_bit(GLF_DEMOTE, &gl->gl_flags);
678 }
673 set_bit(delay ? GLF_PENDING_DEMOTE : GLF_DEMOTE, &gl->gl_flags);
679 }
680 run_queue(gl, 0);
681 spin_unlock(&gl->gl_spin);
682 if (!delay ||
683 queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
684 gfs2_glock_put(gl);
685 if (drop_ref)
686 gfs2_glock_put(gl);

--- 659 unchanged lines hidden (view full) ---

1346 set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
1347 smp_wmb();
1348 gfs2_glock_hold(gl);
1349 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1350 gfs2_glock_put(gl);
1351}
1352
1353
674 }
675 run_queue(gl, 0);
676 spin_unlock(&gl->gl_spin);
677 if (!delay ||
678 queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
679 gfs2_glock_put(gl);
680 if (drop_ref)
681 gfs2_glock_put(gl);

--- 659 unchanged lines hidden (view full) ---

1341 set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
1342 smp_wmb();
1343 gfs2_glock_hold(gl);
1344 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1345 gfs2_glock_put(gl);
1346}
1347
1348
1354static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
1349static int gfs2_shrink_glock_memory(struct shrinker *shrink,
1350 struct shrink_control *sc)
1355{
1356 struct gfs2_glock *gl;
1357 int may_demote;
1358 int nr_skipped = 0;
1351{
1352 struct gfs2_glock *gl;
1353 int may_demote;
1354 int nr_skipped = 0;
1355 int nr = sc->nr_to_scan;
1356 gfp_t gfp_mask = sc->gfp_mask;
1359 LIST_HEAD(skipped);
1360
1361 if (nr == 0)
1362 goto out;
1363
1364 if (!(gfp_mask & __GFP_FS))
1365 return -1;
1366

--- 501 unchanged lines hidden ---
1357 LIST_HEAD(skipped);
1358
1359 if (nr == 0)
1360 goto out;
1361
1362 if (!(gfp_mask & __GFP_FS))
1363 return -1;
1364

--- 501 unchanged lines hidden ---