diff options
author | Bob Peterson <rpeterso@redhat.com> | 2011-03-10 11:41:57 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-03-11 09:24:54 +0000 |
commit | fa1bbdea300a15ec7c1186a5e53de33a5b1672f5 (patch) | |
tree | 7b10ada8427c40494bd752817f5ad9dc7f7db35d /fs | |
parent | 0a33443b38746f35fc4acc8a5af6c7099e03ea40 (diff) | |
download | linux-stable-fa1bbdea300a15ec7c1186a5e53de33a5b1672f5.tar.gz linux-stable-fa1bbdea300a15ec7c1186a5e53de33a5b1672f5.tar.bz2 linux-stable-fa1bbdea300a15ec7c1186a5e53de33a5b1672f5.zip |
GFS2: Optimize glock multiple-dequeue code
This is a small patch that optimizes multiple glock dequeue
operations. It changes the unlock order to be more efficient
and makes it easier for lock debugging tools to unravel. It
also eliminates the need for the temp variable x, although
that would likely be optimized out.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/glock.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 3f45a14009b8..8648409be451 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1248,10 +1248,8 @@ int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs) void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs) { - unsigned int x; - - for (x = 0; x < num_gh; x++) - gfs2_glock_dq(&ghs[x]); + while (num_gh--) + gfs2_glock_dq(&ghs[num_gh]); } /** @@ -1263,10 +1261,8 @@ void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs) void gfs2_glock_dq_uninit_m(unsigned int num_gh, struct gfs2_holder *ghs) { - unsigned int x; - - for (x = 0; x < num_gh; x++) - gfs2_glock_dq_uninit(&ghs[x]); + while (num_gh--) + gfs2_glock_dq_uninit(&ghs[num_gh]); } void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state) |