From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: make xfs_buf_incore out of line
Date: Wed, 18 Apr 2018 08:24:42 -0700 [thread overview]
Message-ID: <20180418152442.GO24738@magnolia> (raw)
In-Reply-To: <20180418114658.agqbu2uf2ti6hly7@odin.usersys.redhat.com>
On Wed, Apr 18, 2018 at 01:46:58PM +0200, Carlos Maiolino wrote:
> On Wed, Apr 18, 2018 at 10:21:10AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > Move xfs_buf_incore out of line and make it the only way to look up
> > a buffer in the buffer cache from outside the buffer cache. Convert
> > the external users of _xfs_buf_find() to xfs_buf_incore() and make
> > _xfs_buf_find() static.
> >
>
> Looks good, but shouldn't it be xfs_incore() instead of xfs_buf_incore() in the
> Subject/description?
I wonder if this function really should be named xfs_buf_incore because
xfs maintains a lot of incore state besides buffers, but as far as this
patch goes I'll fix the commit message on the way in.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> Otherwise
>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
>
>
> > Signed-Off-By: Dave Chinner <dchinner@redhat.com>
> > ---
> > fs/xfs/xfs_buf.c | 21 ++++++++++++++++-----
> > fs/xfs/xfs_buf.h | 17 +++--------------
> > fs/xfs/xfs_qm.c | 5 ++---
> > 3 files changed, 21 insertions(+), 22 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index 55661cbdb51b..2ca8e2c7fbc4 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -549,17 +549,17 @@ xfs_buf_hash_destroy(
> > }
> >
> > /*
> > - * Look up, and creates if absent, a lockable buffer for
> > - * a given range of an inode. The buffer is returned
> > - * locked. No I/O is implied by this call.
> > + * Look up (and insert if absent), a lockable buffer for a given
> > + * range of an inode. The buffer is returned locked. No I/O is
> > + * implied by this call.
> > */
> > -xfs_buf_t *
> > +static struct xfs_buf *
> > _xfs_buf_find(
> > struct xfs_buftarg *btp,
> > struct xfs_buf_map *map,
> > int nmaps,
> > xfs_buf_flags_t flags,
> > - xfs_buf_t *new_bp)
> > + struct xfs_buf *new_bp)
> > {
> > struct xfs_perag *pag;
> > xfs_buf_t *bp;
> > @@ -649,6 +649,17 @@ _xfs_buf_find(
> > return bp;
> > }
> >
> > +struct xfs_buf *
> > +xfs_incore(
> > + struct xfs_buftarg *target,
> > + xfs_daddr_t blkno,
> > + size_t numblks,
> > + xfs_buf_flags_t flags)
> > +{
> > + DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
> > + return _xfs_buf_find(target, &map, 1, flags, NULL);
> > +}
> > +
> > /*
> > * Assembles a buffer covering the specified range. The code is optimised for
> > * cache hits, as metadata intensive workloads will see 3 orders of magnitude
> > diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
> > index edced162a674..e8947c1adac0 100644
> > --- a/fs/xfs/xfs_buf.h
> > +++ b/fs/xfs/xfs_buf.h
> > @@ -218,20 +218,9 @@ typedef struct xfs_buf {
> > } xfs_buf_t;
> >
> > /* Finding and Reading Buffers */
> > -struct xfs_buf *_xfs_buf_find(struct xfs_buftarg *target,
> > - struct xfs_buf_map *map, int nmaps,
> > - xfs_buf_flags_t flags, struct xfs_buf *new_bp);
> > -
> > -static inline struct xfs_buf *
> > -xfs_incore(
> > - struct xfs_buftarg *target,
> > - xfs_daddr_t blkno,
> > - size_t numblks,
> > - xfs_buf_flags_t flags)
> > -{
> > - DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
> > - return _xfs_buf_find(target, &map, 1, flags, NULL);
> > -}
> > +struct xfs_buf *xfs_incore(struct xfs_buftarg *target,
> > + xfs_daddr_t blkno, size_t numblks,
> > + xfs_buf_flags_t flags);
> >
> > struct xfs_buf *_xfs_buf_alloc(struct xfs_buftarg *target,
> > struct xfs_buf_map *map, int nmaps,
> > diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> > index ec39ae274c78..aff4924f637f 100644
> > --- a/fs/xfs/xfs_qm.c
> > +++ b/fs/xfs/xfs_qm.c
> > @@ -1247,9 +1247,8 @@ xfs_qm_flush_one(
> > */
> > if (!xfs_dqflock_nowait(dqp)) {
> > /* buf is pinned in-core by delwri list */
> > - DEFINE_SINGLE_BUF_MAP(map, dqp->q_blkno,
> > - mp->m_quotainfo->qi_dqchunklen);
> > - bp = _xfs_buf_find(mp->m_ddev_targp, &map, 1, 0, NULL);
> > + bp = xfs_incore(mp->m_ddev_targp, dqp->q_blkno,
> > + mp->m_quotainfo->qi_dqchunklen, 0);
> > if (!bp) {
> > error = -EINVAL;
> > goto out_unlock;
> > --
> > 2.16.1
> >
> > --
> > 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
>
> --
> Carlos
> --
> 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
next prev parent reply other threads:[~2018-04-18 15:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 0:21 [PATCH 0/2] xfs: optimise XBF_TRYLOCK buffer lookups Dave Chinner
2018-04-18 0:21 ` [PATCH 1/2] xfs: make xfs_buf_incore out of line Dave Chinner
2018-04-18 10:29 ` Christoph Hellwig
2018-04-18 11:46 ` Carlos Maiolino
2018-04-18 15:24 ` Darrick J. Wong [this message]
2018-04-18 23:34 ` Dave Chinner
2018-04-19 1:10 ` Darrick J. Wong
2018-04-18 0:21 ` [PATCH 2/2] xfs: don't retry xfs_buf_find on XBF_TRYLOCK failure Dave Chinner
2018-04-18 10:30 ` Christoph Hellwig
2018-04-18 11:53 ` Carlos Maiolino
2018-04-18 15:24 ` 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=20180418152442.GO24738@magnolia \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.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).