diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-01-22 12:15:34 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-02-05 13:37:26 -0500 |
commit | b5d32bead1578afc5ca817d40c320764d50a8600 (patch) | |
tree | 522400e0638b263a9973b05f0da40bafcfc8b0bb /fs/gfs2/glock.c | |
parent | f2f5095f9e63db57faa7cb082e958910ecdd7ad4 (diff) |
[GFS2] Tidy up glops calls
This patch doesn't make any changes to the ordering of the various
operations related to glocking, but it does tidy up the calls to the
glops.c functions to make the structure more obvious.
The two functions: gfs2_glock_xmote_th() and gfs2_glock_drop_th() can be
made static within glock.c since they are called by every set of glock
operations. The xmote_th and drop_th glock operations are then made
conditional upon those two routines existing and called from the
previously mentioned functions in glock.c respectively.
Also it can be seen that the go_sync operation isn't needed since it can
easily be replaced by calls to xmote_bh and drop_bh respectively. This
results in no longer (confusingly) calling back into routines in glock.c
from glops.c and also reducing the glock operations by one member.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 1345c3d44ede..5b772bb0210f 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -43,6 +43,8 @@ typedef void (*glock_examiner) (struct gfs2_glock * gl); | |||
43 | static int gfs2_dump_lockstate(struct gfs2_sbd *sdp); | 43 | static int gfs2_dump_lockstate(struct gfs2_sbd *sdp); |
44 | static int dump_glock(struct gfs2_glock *gl); | 44 | static int dump_glock(struct gfs2_glock *gl); |
45 | static int dump_inode(struct gfs2_inode *ip); | 45 | static int dump_inode(struct gfs2_inode *ip); |
46 | static void gfs2_glock_xmote_th(struct gfs2_holder *gh); | ||
47 | static void gfs2_glock_drop_th(struct gfs2_glock *gl); | ||
46 | 48 | ||
47 | #define GFS2_GL_HASH_SHIFT 15 | 49 | #define GFS2_GL_HASH_SHIFT 15 |
48 | #define GFS2_GL_HASH_SIZE (1 << GFS2_GL_HASH_SHIFT) | 50 | #define GFS2_GL_HASH_SIZE (1 << GFS2_GL_HASH_SHIFT) |
@@ -524,7 +526,6 @@ static int rq_promote(struct gfs2_holder *gh) | |||
524 | { | 526 | { |
525 | struct gfs2_glock *gl = gh->gh_gl; | 527 | struct gfs2_glock *gl = gh->gh_gl; |
526 | struct gfs2_sbd *sdp = gl->gl_sbd; | 528 | struct gfs2_sbd *sdp = gl->gl_sbd; |
527 | const struct gfs2_glock_operations *glops = gl->gl_ops; | ||
528 | 529 | ||
529 | if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) { | 530 | if (!relaxed_state_ok(gl->gl_state, gh->gh_state, gh->gh_flags)) { |
530 | if (list_empty(&gl->gl_holders)) { | 531 | if (list_empty(&gl->gl_holders)) { |
@@ -539,7 +540,7 @@ static int rq_promote(struct gfs2_holder *gh) | |||
539 | gfs2_reclaim_glock(sdp); | 540 | gfs2_reclaim_glock(sdp); |
540 | } | 541 | } |
541 | 542 | ||
542 | glops->go_xmote_th(gl, gh->gh_state, gh->gh_flags); | 543 | gfs2_glock_xmote_th(gh); |
543 | spin_lock(&gl->gl_spin); | 544 | spin_lock(&gl->gl_spin); |
544 | } | 545 | } |
545 | return 1; | 546 | return 1; |
@@ -577,7 +578,6 @@ static int rq_promote(struct gfs2_holder *gh) | |||
577 | static int rq_demote(struct gfs2_holder *gh) | 578 | static int rq_demote(struct gfs2_holder *gh) |
578 | { | 579 | { |
579 | struct gfs2_glock *gl = gh->gh_gl; | 580 | struct gfs2_glock *gl = gh->gh_gl; |
580 | const struct gfs2_glock_operations *glops = gl->gl_ops; | ||
581 | 581 | ||
582 | if (!list_empty(&gl->gl_holders)) | 582 | if (!list_empty(&gl->gl_holders)) |
583 | return 1; | 583 | return 1; |
@@ -595,9 +595,9 @@ static int rq_demote(struct gfs2_holder *gh) | |||
595 | 595 | ||
596 | if (gh->gh_state == LM_ST_UNLOCKED || | 596 | if (gh->gh_state == LM_ST_UNLOCKED || |
597 | gl->gl_state != LM_ST_EXCLUSIVE) | 597 | gl->gl_state != LM_ST_EXCLUSIVE) |
598 | glops->go_drop_th(gl); | 598 | gfs2_glock_drop_th(gl); |
599 | else | 599 | else |
600 | glops->go_xmote_th(gl, gh->gh_state, gh->gh_flags); | 600 | gfs2_glock_xmote_th(gh); |
601 | 601 | ||
602 | spin_lock(&gl->gl_spin); | 602 | spin_lock(&gl->gl_spin); |
603 | } | 603 | } |
@@ -909,23 +909,26 @@ static void xmote_bh(struct gfs2_glock *gl, unsigned int ret) | |||
909 | * | 909 | * |
910 | */ | 910 | */ |
911 | 911 | ||
912 | void gfs2_glock_xmote_th(struct gfs2_glock *gl, unsigned int state, int flags) | 912 | void gfs2_glock_xmote_th(struct gfs2_holder *gh) |
913 | { | 913 | { |
914 | struct gfs2_glock *gl = gh->gh_gl; | ||
914 | struct gfs2_sbd *sdp = gl->gl_sbd; | 915 | struct gfs2_sbd *sdp = gl->gl_sbd; |
916 | int flags = gh->gh_flags; | ||
917 | unsigned state = gh->gh_state; | ||
915 | const struct gfs2_glock_operations *glops = gl->gl_ops; | 918 | const struct gfs2_glock_operations *glops = gl->gl_ops; |
916 | int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB | | 919 | int lck_flags = flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB | |
917 | LM_FLAG_NOEXP | LM_FLAG_ANY | | 920 | LM_FLAG_NOEXP | LM_FLAG_ANY | |
918 | LM_FLAG_PRIORITY); | 921 | LM_FLAG_PRIORITY); |
919 | unsigned int lck_ret; | 922 | unsigned int lck_ret; |
920 | 923 | ||
924 | if (glops->go_xmote_th) | ||
925 | glops->go_xmote_th(gl); | ||
926 | |||
921 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | 927 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); |
922 | gfs2_assert_warn(sdp, queue_empty(gl, &gl->gl_holders)); | 928 | gfs2_assert_warn(sdp, queue_empty(gl, &gl->gl_holders)); |
923 | gfs2_assert_warn(sdp, state != LM_ST_UNLOCKED); | 929 | gfs2_assert_warn(sdp, state != LM_ST_UNLOCKED); |
924 | gfs2_assert_warn(sdp, state != gl->gl_state); | 930 | gfs2_assert_warn(sdp, state != gl->gl_state); |
925 | 931 | ||
926 | if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync) | ||
927 | glops->go_sync(gl); | ||
928 | |||
929 | gfs2_glock_hold(gl); | 932 | gfs2_glock_hold(gl); |
930 | gl->gl_req_bh = xmote_bh; | 933 | gl->gl_req_bh = xmote_bh; |
931 | 934 | ||
@@ -994,19 +997,19 @@ static void drop_bh(struct gfs2_glock *gl, unsigned int ret) | |||
994 | * | 997 | * |
995 | */ | 998 | */ |
996 | 999 | ||
997 | void gfs2_glock_drop_th(struct gfs2_glock *gl) | 1000 | static void gfs2_glock_drop_th(struct gfs2_glock *gl) |
998 | { | 1001 | { |
999 | struct gfs2_sbd *sdp = gl->gl_sbd; | 1002 | struct gfs2_sbd *sdp = gl->gl_sbd; |
1000 | const struct gfs2_glock_operations *glops = gl->gl_ops; | 1003 | const struct gfs2_glock_operations *glops = gl->gl_ops; |
1001 | unsigned int ret; | 1004 | unsigned int ret; |
1002 | 1005 | ||
1006 | if (glops->go_drop_th) | ||
1007 | glops->go_drop_th(gl); | ||
1008 | |||
1003 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); | 1009 | gfs2_assert_warn(sdp, test_bit(GLF_LOCK, &gl->gl_flags)); |
1004 | gfs2_assert_warn(sdp, queue_empty(gl, &gl->gl_holders)); | 1010 | gfs2_assert_warn(sdp, queue_empty(gl, &gl->gl_holders)); |
1005 | gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); | 1011 | gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED); |
1006 | 1012 | ||
1007 | if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync) | ||
1008 | glops->go_sync(gl); | ||
1009 | |||
1010 | gfs2_glock_hold(gl); | 1013 | gfs2_glock_hold(gl); |
1011 | gl->gl_req_bh = drop_bh; | 1014 | gl->gl_req_bh = drop_bh; |
1012 | 1015 | ||