* [Cluster-devel] [GFS2 PATCH] Optimize glock multiple-dequeue code
[not found] <198132160.393307.1299774963945.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
@ 2011-03-10 16:41 ` Bob Peterson
2011-03-11 10:08 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2011-03-10 16:41 UTC (permalink / raw)
To: cluster-devel.redhat.com
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
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
--
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 3f45a14..8648409 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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] Optimize glock multiple-dequeue code
2011-03-10 16:41 ` [Cluster-devel] [GFS2 PATCH] Optimize glock multiple-dequeue code Bob Peterson
@ 2011-03-11 10:08 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2011-03-11 10:08 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
On Thu, 2011-03-10 at 11:41 -0500, Bob Peterson wrote:
> 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
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> --
> 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.
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index 3f45a14..8648409 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)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-11 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <198132160.393307.1299774963945.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2011-03-10 16:41 ` [Cluster-devel] [GFS2 PATCH] Optimize glock multiple-dequeue code Bob Peterson
2011-03-11 10:08 ` Steven Whitehouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).