public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/9] xfs: separate buffer indexing from block map
Date: Wed, 20 Jun 2012 17:36:36 +1000	[thread overview]
Message-ID: <20120620073636.GI30705@dastard> (raw)
In-Reply-To: <20120620064451.GB14760@infradead.org>

On Wed, Jun 20, 2012 at 02:44:51AM -0400, Christoph Hellwig wrote:
> On Fri, Jun 08, 2012 at 03:38:26PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > To support discontiguous buffers in the buffer cache, we need to
> > separate the cache index variables from the I/O map. While this is
> > currently a 1:1 mapping, discontiguous buffer support will break
> > this relationship.
> > 
> > However, for caching purposes, we can still treat them the same as a
> > contiguous buffer - the block number of the first block and the
> > length of the buffer - as that is still a unique representation.
> > Also, the only way we will ever access the discontiguous regions of
> > buffers is via bulding the complete buffer in the first place, so
> > using the initial block number and entire buffer length is a sane
> > way to index the buffers.
> > 
> > Add a block mapping vector construct to the xfs_buf and use it in
> > the places where we are doing IO instead of the current
> > b_bn/b_length variables.
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> >  fs/xfs/xfs_buf.c |   21 ++++++++++++---------
> >  fs/xfs/xfs_buf.h |   17 +++++++++++++----
> >  2 files changed, 25 insertions(+), 13 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index a4beb42..90c5b6a 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -199,9 +199,11 @@ xfs_buf_alloc(
> >  	 * most cases but may be reset (e.g. XFS recovery).
> >  	 */
> >  	bp->b_length = numblks;
> > +	bp->b_map.bm_len = numblks;
> >  	bp->b_io_length = numblks;
> >  	bp->b_flags = flags;
> >  	bp->b_bn = blkno;
> > +	bp->b_map.bm_bn = blkno;
> 
> nipick: any reason not to initialize the two fields of b_map next
> to each other?

Not really. The end up together in the end, and this was just
keeping all the block inits and length inits together and then later
(re)moving them one at a time...

> >  #ifdef XFS_BUF_LOCK_TRACKING
> >  	int			b_last_holder;
> >  #endif
> > @@ -233,8 +242,8 @@ void xfs_buf_stale(struct xfs_buf *bp);
> >  #define XFS_BUF_UNWRITE(bp)	((bp)->b_flags &= ~XBF_WRITE)
> >  #define XFS_BUF_ISWRITE(bp)	((bp)->b_flags & XBF_WRITE)
> >  
> > -#define XFS_BUF_ADDR(bp)		((bp)->b_bn)
> > -#define XFS_BUF_SET_ADDR(bp, bno)	((bp)->b_bn = (xfs_daddr_t)(bno))
> > +#define XFS_BUF_ADDR(bp)		((bp)->b_map.bm_bn)
> > +#define XFS_BUF_SET_ADDR(bp, bno)	((bp)->b_map.bm_bn = (xfs_daddr_t)(bno))
> 
> It's not really obvious why XFS_BUF_SET_ADDR should not set b_bn from
> it's defintion.  Looking at the callers it seems because it's only used
> for uncached buffers, which never use b_bn, but it's still confusing.

Right - b_bn is really there for the cache indexing now, so we don't
have to take an extra cacheline misson every buffer we search during
a lookup. I'm not sure what the best way to make that distinction
clear is...

> I'm fine with keeping it for now bith a big comment to get this series
> in, but XFS_BUF_SET_ADDR and b_io_length probably should go away ASAP in
> favor or a variant of xfs_buf_iorequest that takes a bn/len pair .

Sounds like a good plan - I'll have a look at implementing that in
the next couple of days.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-06-20  7:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08  5:38 [PATCH 0/9] xfs: discontiguous directory buffer support Dave Chinner
2012-06-08  5:38 ` [PATCH 1/9] xfs: separate buffer indexing from block map Dave Chinner
2012-06-18 20:39   ` Ben Myers
2012-06-20  6:44   ` Christoph Hellwig
2012-06-20  7:36     ` Dave Chinner [this message]
2012-06-08  5:38 ` [PATCH 2/9] xfs: convert internal buffer functions to pass maps Dave Chinner
2012-06-18 20:43   ` Ben Myers
2012-06-18 21:07     ` Ben Myers
2012-06-19  7:15       ` Christoph Hellwig
2012-06-19 15:59         ` Ben Myers
2012-06-19 17:03           ` Christoph Hellwig
2012-06-19 17:11             ` Ben Myers
2012-06-20  5:56               ` Dave Chinner
2012-06-20  6:04                 ` Christoph Hellwig
2012-06-20  6:29                   ` Dave Chinner
2012-06-20  6:46                     ` Dave Chinner
2012-06-20 15:39                       ` Ben Myers
2012-06-20 15:36                     ` Ben Myers
2012-06-20 23:04                       ` Dave Chinner
2012-06-20  6:35                   ` Dave Chinner
2012-06-20 15:48                     ` Ben Myers
2012-06-20  6:29               ` Christoph Hellwig
2012-06-20  6:37                 ` Dave Chinner
2012-06-20 15:51                   ` Ben Myers
2012-06-20  6:48   ` Christoph Hellwig
2012-06-22  6:48     ` Dave Chinner
2012-06-08  5:38 ` [PATCH 3/9] xfs: add discontiguous buffer map interface Dave Chinner
2012-06-20  6:53   ` Christoph Hellwig
2012-06-08  5:38 ` [PATCH 4/9] xfs: add discontiguous buffer support to transactions Dave Chinner
2012-06-20  6:54   ` Christoph Hellwig
2012-06-08  5:38 ` [PATCH 5/9] xfs: struct xfs_buf_log_format isn't variable sized Dave Chinner
2012-06-20  6:36   ` Christoph Hellwig
2012-06-20  7:01     ` Dave Chinner
2012-06-20  7:05       ` Christoph Hellwig
2012-06-08  5:38 ` [PATCH 6/9] xfs: support discontiguous buffers in the xfs_buf_log_item Dave Chinner
2012-06-20  7:15   ` Christoph Hellwig
2012-06-08  5:38 ` [PATCH 7/9] xfs: use multiple irec xfs buf support in dabuf Dave Chinner
2012-06-20  7:18   ` Christoph Hellwig
2012-06-08  5:38 ` [PATCH 8/9] xfs: remove struct xfs_dabuf and infrastructure Dave Chinner
2012-06-20  7:20   ` Christoph Hellwig
2012-06-08  5:38 ` [PATCH 9/9] xfs: factor buffer reading from xfs_dir2_leaf_getdents Dave Chinner
2012-06-20  7:27   ` Christoph Hellwig
2012-06-20  7:41     ` Dave Chinner

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=20120620073636.GI30705@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox