Skip to content

Commit

Permalink
GFS2: Optimize glock multiple-dequeue code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bob Peterson authored and Steven Whitehouse committed Mar 11, 2011
1 parent 0a33443 commit fa1bbde
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

/**
Expand All @@ -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)
Expand Down

0 comments on commit fa1bbde

Please sign in to comment.