From: Dave Chinner <david@fromorbit.com>
To: Mark Tinguely <tinguely@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 02/10] xfs: separate buffer indexing from block map
Date: Wed, 2 May 2012 11:16:10 +1000 [thread overview]
Message-ID: <20120502011610.GC25351@dastard> (raw)
In-Reply-To: <4F9FE24B.3090603@sgi.com>
On Tue, May 01, 2012 at 08:16:59AM -0500, Mark Tinguely wrote:
> On 04/30/12 18:24, Dave Chinner wrote:
> >On Mon, Apr 30, 2012 at 02:28:44PM -0500, Mark Tinguely wrote:
> >>On 04/24/12 01:33, 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>
> >>...
> >>>+struct xfs_buf_map {
> >>>+ xfs_daddr_t bm_bn; /* block number for I/O */
> >>>+ int bm_len; /* size of I/O */
> >>>+};
> >>>+
> >>> typedef struct xfs_buf {
> >>> /*
> >>> * first cacheline holds all the fields needed for an uncontended cache
> >>>@@ -107,7 +114,7 @@ typedef struct xfs_buf {
> >>> * fast-path on locking.
> >>> */
> >>> struct rb_node b_rbnode; /* rbtree node */
> >>>- xfs_daddr_t b_bn; /* block number for I/O */
> >>>+ xfs_daddr_t b_bn; /* block number of buffer */
> >>> int b_length; /* size of buffer in BBs */
> >>
> >>Looks good.
> >>Do you plan to eventually remove b_bn and b_length from xfs_buf?
> >
> >No. b_bn is a fast way of identifying unique buffers for cache
> >lookups and is located in the same cacheline as the tree node so we
> >don't take an extra cache miss on every buffer we traverse during
> >tree walks in _xfs_buf_find(). Also, b_length is used so often it is
> >much cleaner to keep it around than it s to iterate over all the
> >maps to calculate it every time it is needed.
>
> Thanks for the reply. I was thinking that maybe the "inline" map
> could do both of those things. It is not used if there are multiple
> maps and is the same value as the original variables if there is
> only one map.
I thought about doing that, but then the code gets harder to follow.
e.g. why do we use bp->b_map.b_bn in some places, and
bp->b_maps[0].b_bn in others when most of the time they both point
to the same thing? It just maps it too easy to
misunderstand/misuse/confuse the difference between the buffer
identifiers and the real IO block addresses. I prefer the clarity of
purpose that retaining b_bn/b_length gives, even though there is a
slight increase in memory usage....
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:[~2012-05-02 1:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 6:33 [PATCH 00/10] xfs: discontiguous buffer support a.k.a. die xfs_dabuf die Dave Chinner
2012-04-24 6:33 ` [PATCH 01/10] xfs: add trace points for log forces Dave Chinner
2012-04-30 19:25 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 02/10] xfs: separate buffer indexing from block map Dave Chinner
2012-04-30 19:28 ` Mark Tinguely
2012-04-30 23:24 ` Dave Chinner
2012-05-01 13:16 ` Mark Tinguely
2012-05-02 1:16 ` Dave Chinner [this message]
2012-04-24 6:33 ` [PATCH 03/10] xfs: convert internal buffer functions to pass maps Dave Chinner
2012-05-01 15:13 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 04/10] xfs: add discontiguous buffer map interface Dave Chinner
2012-05-01 18:10 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 05/10] xfs: add discontiguous buffer support to transactions Dave Chinner
2012-05-03 19:41 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 06/10] xfs: struct xfs_buf_log_format isn't variable sized Dave Chinner
2012-05-02 13:39 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 07/10] xfs: support discontiguous buffers in the xfs_buf_log_item Dave Chinner
2012-05-03 19:42 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 08/10] xfs: use multiple irec xfs buf support in dabuf Dave Chinner
2012-05-03 19:43 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 09/10] xfs: remove struct xfs_dabuf and infrastructure Dave Chinner
2012-05-04 19:54 ` Mark Tinguely
2012-04-24 6:33 ` [PATCH 10/10] xfs: factor buffer reading from xfs_dir2_leaf_getdents Dave Chinner
2012-05-04 12:42 ` Mark Tinguely
2012-05-16 17:40 ` [PATCH 00/10] xfs: discontiguous buffer support a.k.a. die xfs_dabuf die Ben Myers
2012-05-23 9:27 ` Dave Chinner
2012-05-30 14:48 ` Ben Myers
2012-05-30 19:48 ` Ben Myers
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=20120502011610.GC25351@dastard \
--to=david@fromorbit.com \
--cc=tinguely@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox