From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: xfs <linux-xfs@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Brian Foster <bfoster@redhat.com>
Subject: Re: [PATCH] xfs: refactor dir2 leaf readahead shadow buffer cleverness
Date: Tue, 2 May 2017 00:44:00 -0700 [thread overview]
Message-ID: <20170502074400.GB19021@infradead.org> (raw)
In-Reply-To: <20170428194652.GG22884@birch.djwong.org>
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;
> + 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.
> + 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.
> + 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.
next prev parent reply other threads:[~2017-05-02 7:44 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 [this message]
2017-05-02 19:02 ` Darrick J. Wong
-- 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=20170502074400.GB19021@infradead.org \
--to=hch@infradead.org \
--cc=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--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 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).