From: Dave Chinner <david@fromorbit.com>
To: Alex Elder <aelder@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCHv2 8/10] xfs: avoid repeated pointer dereferences
Date: Mon, 12 Apr 2010 16:56:44 +1000 [thread overview]
Message-ID: <20100412065644.GJ2493@dastard> (raw)
In-Reply-To: <1270852242.7840.158.camel@doink>
On Fri, Apr 09, 2010 at 05:30:42PM -0500, Alex Elder wrote:
> In xlog_find_cycle_start() use a local variable for some repeated
> operations rather than constantly updating the memory location
> whose address is passed in.
Won't the compiler optimise that out for us? i.e. does the dissassembly
of the function look any better before and after this change?
> Signed-off-by: Alex Elder <aelder@sgi.com>
>
> ---
> fs/xfs/xfs_log_recover.c | 83 ++++++++++++++++++++++++-----------------------
> fs/xfs/xfs_log_recover.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> Index: b/fs/xfs/xfs_log_recover.c
> ===================================================================
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -354,26 +354,28 @@ xlog_find_cycle_start(
> {
> xfs_caddr_t offset;
> xfs_daddr_t mid_blk;
> + xfs_daddr_t end_blk;
> uint mid_cycle;
> int error;
>
> - mid_blk = BLK_AVG(first_blk, *last_blk);
> - while (mid_blk != first_blk && mid_blk != *last_blk) {
> + ASSERT(last_blk != NULL);
> + end_blk = *last_blk;
FWIW, there is no need for that ASSERT there - the machine will
panic on the very next line, anyway....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-04-13 1:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-09 22:30 [PATCHv2 8/10] xfs: avoid repeated pointer dereferences Alex Elder
2010-04-12 6:56 ` Dave Chinner [this message]
2010-04-14 21:02 ` Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100412065644.GJ2493@dastard \
--to=david@fromorbit.com \
--cc=aelder@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.