Optimize glock multiple-dequeue code
A message that is not in the archive (sent off-list or not yet received): 198132160.393307.1299774963945.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com
PATCH 1/1 Optimize glock multiple-dequeue code
Hi,
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.
Regards,
Bob Peterson
Red Hat File Systems
--
fs/gfs2/glock.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
fs/gfs2/glock.c +4 -8
@@ -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)
PATCH 1/1 Optimize glock multiple-dequeue code
Hi,
Quoted 10 lines · Bob Peterson
Hi,
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.
Regards,
Quoted 8 lines
Bob Peterson
Red Hat File SystemsSigned-off-by Bob Peterson <[email protected]>--
fs/gfs2/glock.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
I'm still not convinced that this really makes a difference, but it doesn't do any harm either, so I've pushed it into the -nmw tree,
Steve.
Quoted 31 lines
fs/gfs2/glock.c +4
-8@@ -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)