diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-05-23 09:46:04 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-06-27 04:39:28 -0400 |
commit | 048bca223739368aa5b9ce7cfb1d576c32d66cc7 (patch) | |
tree | 66d4f1c0e90eb6429755cb4529f8c7f609026e89 /fs/gfs2/glock.c | |
parent | f3c9d38a26be32abf9b8897e9e0afc7166c712dd (diff) |
[GFS2] No lock_nolock
This patch merges the lock_nolock module into GFS2 itself. As well as removing
some of the overhead of the module, it also means that its now impossible to
build GFS2 without a lock module (which would be a pointless thing to do
anyway).
We also plan to merge lock_dlm into GFS2 in the future, but that is a more
tricky task, and will therefore be a separate patch.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 519a54cc0b7b..be7ed503f012 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -153,7 +153,7 @@ static void glock_free(struct gfs2_glock *gl) | |||
153 | struct gfs2_sbd *sdp = gl->gl_sbd; | 153 | struct gfs2_sbd *sdp = gl->gl_sbd; |
154 | struct inode *aspace = gl->gl_aspace; | 154 | struct inode *aspace = gl->gl_aspace; |
155 | 155 | ||
156 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 156 | if (sdp->sd_lockstruct.ls_ops->lm_put_lock) |
157 | sdp->sd_lockstruct.ls_ops->lm_put_lock(gl->gl_lock); | 157 | sdp->sd_lockstruct.ls_ops->lm_put_lock(gl->gl_lock); |
158 | 158 | ||
159 | if (aspace) | 159 | if (aspace) |
@@ -488,6 +488,10 @@ static unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock, | |||
488 | unsigned int flags) | 488 | unsigned int flags) |
489 | { | 489 | { |
490 | int ret = LM_OUT_ERROR; | 490 | int ret = LM_OUT_ERROR; |
491 | |||
492 | if (!sdp->sd_lockstruct.ls_ops->lm_lock) | ||
493 | return req_state == LM_ST_UNLOCKED ? 0 : req_state; | ||
494 | |||
491 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 495 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
492 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state, | 496 | ret = sdp->sd_lockstruct.ls_ops->lm_lock(lock, cur_state, |
493 | req_state, flags); | 497 | req_state, flags); |
@@ -631,6 +635,8 @@ static int gfs2_lm_get_lock(struct gfs2_sbd *sdp, struct lm_lockname *name, | |||
631 | void **lockp) | 635 | void **lockp) |
632 | { | 636 | { |
633 | int error = -EIO; | 637 | int error = -EIO; |
638 | if (!sdp->sd_lockstruct.ls_ops->lm_get_lock) | ||
639 | return 0; | ||
634 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 640 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
635 | error = sdp->sd_lockstruct.ls_ops->lm_get_lock( | 641 | error = sdp->sd_lockstruct.ls_ops->lm_get_lock( |
636 | sdp->sd_lockstruct.ls_lockspace, name, lockp); | 642 | sdp->sd_lockstruct.ls_lockspace, name, lockp); |
@@ -910,7 +916,8 @@ do_cancel: | |||
910 | gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list); | 916 | gh = list_entry(gl->gl_holders.next, struct gfs2_holder, gh_list); |
911 | if (!(gh->gh_flags & LM_FLAG_PRIORITY)) { | 917 | if (!(gh->gh_flags & LM_FLAG_PRIORITY)) { |
912 | spin_unlock(&gl->gl_spin); | 918 | spin_unlock(&gl->gl_spin); |
913 | sdp->sd_lockstruct.ls_ops->lm_cancel(gl->gl_lock); | 919 | if (sdp->sd_lockstruct.ls_ops->lm_cancel) |
920 | sdp->sd_lockstruct.ls_ops->lm_cancel(gl->gl_lock); | ||
914 | spin_lock(&gl->gl_spin); | 921 | spin_lock(&gl->gl_spin); |
915 | } | 922 | } |
916 | return; | 923 | return; |
@@ -1187,6 +1194,8 @@ void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs) | |||
1187 | static int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp) | 1194 | static int gfs2_lm_hold_lvb(struct gfs2_sbd *sdp, void *lock, char **lvbp) |
1188 | { | 1195 | { |
1189 | int error = -EIO; | 1196 | int error = -EIO; |
1197 | if (!sdp->sd_lockstruct.ls_ops->lm_hold_lvb) | ||
1198 | return 0; | ||
1190 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 1199 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
1191 | error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp); | 1200 | error = sdp->sd_lockstruct.ls_ops->lm_hold_lvb(lock, lvbp); |
1192 | return error; | 1201 | return error; |
@@ -1226,7 +1235,7 @@ void gfs2_lvb_unhold(struct gfs2_glock *gl) | |||
1226 | gfs2_glock_hold(gl); | 1235 | gfs2_glock_hold(gl); |
1227 | gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0); | 1236 | gfs2_assert(gl->gl_sbd, atomic_read(&gl->gl_lvb_count) > 0); |
1228 | if (atomic_dec_and_test(&gl->gl_lvb_count)) { | 1237 | if (atomic_dec_and_test(&gl->gl_lvb_count)) { |
1229 | if (likely(!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 1238 | if (sdp->sd_lockstruct.ls_ops->lm_unhold_lvb) |
1230 | sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(gl->gl_lock, gl->gl_lvb); | 1239 | sdp->sd_lockstruct.ls_ops->lm_unhold_lvb(gl->gl_lock, gl->gl_lvb); |
1231 | gl->gl_lvb = NULL; | 1240 | gl->gl_lvb = NULL; |
1232 | gfs2_glock_put(gl); | 1241 | gfs2_glock_put(gl); |