diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2010-11-29 07:50:38 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-11-30 05:31:48 -0500 |
commit | 921169ca2f7c8a0a2ccda2ce33c465dfe3ae30ef (patch) | |
tree | f40f00721426eb992d75493defefb8de8a71b7e1 /fs/gfs2/glock.c | |
parent | 802ec9b6682349d9d9c92a9e55f44324d2954f41 (diff) |
GFS2: Clean up of gdlm_lock function
The DLM never returns -EAGAIN in response to dlm_lock(), and even
if it did, the test in gdlm_lock() was wrong anyway. Once that
test is removed, it is possible to greatly simplify this code
by simply using a "normal" error return code (0 for success).
We then no longer need the LM_OUT_ASYNC return code which can
be removed.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index a9b53a48abeb..2dd1d7238111 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -541,21 +541,6 @@ out_locked: | |||
541 | spin_unlock(&gl->gl_spin); | 541 | spin_unlock(&gl->gl_spin); |
542 | } | 542 | } |
543 | 543 | ||
544 | static unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock, | ||
545 | unsigned int req_state, | ||
546 | unsigned int flags) | ||
547 | { | ||
548 | int ret = LM_OUT_ERROR; | ||
549 | |||
550 | if (!sdp->sd_lockstruct.ls_ops->lm_lock) | ||
551 | return req_state == LM_ST_UNLOCKED ? 0 : req_state; | ||
552 | |||
553 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | ||
554 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, | ||
555 | req_state, flags); | ||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | /** | 544 | /** |
560 | * do_xmote - Calls the DLM to change the state of a lock | 545 | * do_xmote - Calls the DLM to change the state of a lock |
561 | * @gl: The lock state | 546 | * @gl: The lock state |
@@ -575,8 +560,8 @@ __acquires(&gl->gl_spin) | |||
575 | 560 | ||
576 | lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | | 561 | lck_flags &= (LM_FLAG_TRY | LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | |
577 | LM_FLAG_PRIORITY); | 562 | LM_FLAG_PRIORITY); |
578 | BUG_ON(gl->gl_state == target); | 563 | GLOCK_BUG_ON(gl, gl->gl_state == target); |
579 | BUG_ON(gl->gl_state == gl->gl_target); | 564 | GLOCK_BUG_ON(gl, gl->gl_state == gl->gl_target); |
580 | if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) && | 565 | if ((target == LM_ST_UNLOCKED || target == LM_ST_DEFERRED) && |
581 | glops->go_inval) { | 566 | glops->go_inval) { |
582 | set_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags); | 567 | set_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags); |
@@ -594,15 +579,17 @@ __acquires(&gl->gl_spin) | |||
594 | gl->gl_state == LM_ST_DEFERRED) && | 579 | gl->gl_state == LM_ST_DEFERRED) && |
595 | !(lck_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) | 580 | !(lck_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) |
596 | lck_flags |= LM_FLAG_TRY_1CB; | 581 | lck_flags |= LM_FLAG_TRY_1CB; |
597 | ret = gfs2_lm_lock(sdp, gl, target, lck_flags); | ||
598 | 582 | ||
599 | if (!(ret & LM_OUT_ASYNC)) { | 583 | if (sdp->sd_lockstruct.ls_ops->lm_lock) { |
600 | finish_xmote(gl, ret); | 584 | /* lock_dlm */ |
585 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(gl, target, lck_flags); | ||
586 | GLOCK_BUG_ON(gl, ret); | ||
587 | } else { /* lock_nolock */ | ||
588 | finish_xmote(gl, target); | ||
601 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) | 589 | if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) |
602 | gfs2_glock_put(gl); | 590 | gfs2_glock_put(gl); |
603 | } else { | ||
604 | GLOCK_BUG_ON(gl, ret != LM_OUT_ASYNC); | ||
605 | } | 591 | } |
592 | |||
606 | spin_lock(&gl->gl_spin); | 593 | spin_lock(&gl->gl_spin); |
607 | } | 594 | } |
608 | 595 | ||