aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-09 17:07:05 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-09 17:07:05 -0400
commita5e08a9ef50e8b6feb099f8e4b253df04f5ec9db (patch)
tree9d35e98597a51e39435fcc67f172f1ec14c6dbe4 /fs/gfs2
parent087efdd391f47305dc251a7b00dcc5d69e8c636a (diff)
[GFS2] Add consts to glock sorting function
Add back the consts which were casted away in the glock sorting function. Also add early exit code. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 8abfefe4efd4..e941183bbcdb 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1494,26 +1494,20 @@ int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number,
1494 1494
1495static int glock_compare(const void *arg_a, const void *arg_b) 1495static int glock_compare(const void *arg_a, const void *arg_b)
1496{ 1496{
1497 struct gfs2_holder *gh_a = *(struct gfs2_holder **)arg_a; 1497 const struct gfs2_holder *gh_a = *(const struct gfs2_holder **)arg_a;
1498 struct gfs2_holder *gh_b = *(struct gfs2_holder **)arg_b; 1498 const struct gfs2_holder *gh_b = *(const struct gfs2_holder **)arg_b;
1499 struct lm_lockname *a = &gh_a->gh_gl->gl_name; 1499 const struct lm_lockname *a = &gh_a->gh_gl->gl_name;
1500 struct lm_lockname *b = &gh_b->gh_gl->gl_name; 1500 const struct lm_lockname *b = &gh_b->gh_gl->gl_name;
1501 int ret = 0;
1502 1501
1503 if (a->ln_number > b->ln_number) 1502 if (a->ln_number > b->ln_number)
1504 ret = 1; 1503 return 1;
1505 else if (a->ln_number < b->ln_number) 1504 if (a->ln_number < b->ln_number)
1506 ret = -1; 1505 return -1;
1507 else { 1506 if (gh_a->gh_state == LM_ST_SHARED && gh_b->gh_state == LM_ST_EXCLUSIVE)
1508 if (gh_a->gh_state == LM_ST_SHARED && 1507 return 1;
1509 gh_b->gh_state == LM_ST_EXCLUSIVE) 1508 if (!(gh_a->gh_flags & GL_LOCAL_EXCL) && (gh_b->gh_flags & GL_LOCAL_EXCL))
1510 ret = 1; 1509 return 1;
1511 else if (!(gh_a->gh_flags & GL_LOCAL_EXCL) && 1510 return 0;
1512 (gh_b->gh_flags & GL_LOCAL_EXCL))
1513 ret = 1;
1514 }
1515
1516 return ret;
1517} 1511}
1518 1512
1519/** 1513/**