All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs <linux-xfs@vger.kernel.org>, Brian Foster <bfoster@redhat.com>
Subject: Re: [PATCH] xfs: refactor dir2 leaf readahead shadow buffer cleverness
Date: Tue, 2 May 2017 12:02:28 -0700	[thread overview]
Message-ID: <20170502190228.GB5973@birch.djwong.org> (raw)
In-Reply-To: <20170502074400.GB19021@infradead.org>

On Tue, May 02, 2017 at 12:44:00AM -0700, Christoph Hellwig wrote:
> Hi Darrick,
> 
> a few comments below.  Most are cosmetic except for one which is
> a minor improvement.
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> with the cosmetic bits fixed up.
> 
> > +	last_da = xfs_dir2_byte_to_da(geo, XFS_DIR2_LEAF_OFFSET);
> > +	map_off = xfs_dir2_db_to_da(geo, xfs_dir2_byte_to_db(geo, *cur_off));
> > +	found = xfs_iext_lookup_extent(dp, ifp, map_off, &idx, &map);
> > +	if (!found || map.br_startoff >= last_da)
> >  		goto out;
> 
> I don't think we need the found variable in this function, all the users
> only check for in the next line and then ignore it.  E.g. rewrite this
> into
> 
> 	if (!xfs_iext_lookup_extent(dp, ifp, map_off, &idx, &map))
> 		goto out;
> 	if (map.br_startoff >= last_da))
> 		goto out;

Ok.

> > +	ra_want = howmany(bufsize + geo->blksize, (1 << geo->fsblog));
> > +	if (*ra_blk >= last_da)
> > +		goto out;
> > +	else if (*ra_blk == 0)
> > +		*ra_blk = map.br_startoff;
> 
> No need for the else here.

Ok.

> > +	next_ra = map.br_startoff + geo->fsbcount;
> > +	if (next_ra >= last_da)
> > +		goto out_no_ra;
> > +	found = xfs_iext_lookup_extent(dp, ifp, next_ra, &idx, &map);
> 
> Do we really need a new full lookup here?  This should be the same
> or the next map compared to the one the original xfs_iext_lookup_extent
> returned.  So just checking if it's in the original map that could
> be stashed away or otherwise calling xfs_iext_get_extent would more
> efficient.

Sure, that could be something like:

	next_ra = map.br_startoff + geo->fsbcount;
	if (next_ra >= last_da)
		goto out_no_ra;
	if (map.br_blockcount < geo->fsbcount &&
	    !xfs_iext_get_extent(ifp, ++idx, &map))
		goto out_no_ra;
	if (map.br_startoff >= last_da)
		goto out_no_ra;
	xfs_trim_extent(&map, next_ra, last_da - next_ra);

> > +	while (ra_want > 0) {
> > +		next_ra = roundup((xfs_dablk_t)map.br_startoff, geo->fsbcount);
> > +		while (ra_want > 0 &&
> > +		       next_ra < map.br_startoff + map.br_blockcount) {
> > +			if (next_ra >= last_da) {
> > +				*ra_blk = last_da;
> > +				break;
> > +			} else if (next_ra > *ra_blk) {
> 
> No need for the else.

Ok.

--D
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-05-02 19:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 19:46 [PATCH] xfs: refactor dir2 leaf readahead shadow buffer cleverness Darrick J. Wong
2017-05-01 18:32 ` Brian Foster
2017-05-01 21:50   ` Darrick J. Wong
2017-05-01 23:13     ` Brian Foster
2017-05-01 23:30       ` Darrick J. Wong
2017-05-02 14:11         ` Brian Foster
2017-05-02  7:44 ` Christoph Hellwig
2017-05-02 19:02   ` Darrick J. Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-19  0:14 Darrick J. Wong
2017-04-19  1:34 ` Dave Chinner
2017-04-22 12:15 ` Brian Foster
2017-04-24 21:31   ` Darrick J. Wong

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=20170502190228.GB5973@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    /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.