All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 05/16] xfs: convert directory dablk conversion to xfs_da_geometry
Date: Mon, 26 May 2014 14:48:40 +1000	[thread overview]
Message-ID: <20140526044840.GX8554@dastard> (raw)
In-Reply-To: <20140523190622.GF8343@laptop.bfoster>

On Fri, May 23, 2014 at 03:06:22PM -0400, Brian Foster wrote:
> On Fri, May 23, 2014 at 10:03:41AM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> >  fs/xfs/xfs_da_btree.h     | 15 +++++++--------
> >  fs/xfs/xfs_dir2.c         |  4 ++--
> >  fs/xfs/xfs_dir2_data.c    |  4 ++--
> >  fs/xfs/xfs_dir2_leaf.c    | 21 +++++++++++----------
> >  fs/xfs/xfs_dir2_node.c    | 41 +++++++++++++++++++++++------------------
> >  fs/xfs/xfs_dir2_readdir.c |  6 +++---
> >  6 files changed, 48 insertions(+), 43 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
> > index e9496a9..8db83fc 100644
> > --- a/fs/xfs/xfs_da_btree.h
> > +++ b/fs/xfs/xfs_da_btree.h
> > @@ -232,9 +232,9 @@ xfs_dir2_db_off_to_byte(struct xfs_da_geometry *geo, xfs_dir2_db_t db,
> >   * Convert block (DB) to block (dablk)
> >   */
> >  static inline xfs_dablk_t
> > -xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db)
> > +xfs_dir2_db_to_da(struct xfs_da_geometry *geo, xfs_dir2_db_t db)
> >  {
> > -	return (xfs_dablk_t)(db << mp->m_sb.sb_dirblklog);
> > +	return (xfs_dablk_t)(db << (geo->blklog - geo->fsblog));
> >  }
> >  
> >  /*
> > @@ -243,7 +243,7 @@ xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db)
> >  static inline xfs_dablk_t
> >  xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by)
> >  {
> > -	return xfs_dir2_db_to_da(mp, xfs_dir2_byte_to_db(mp, by));
> > +	return xfs_dir2_db_to_da(mp->m_dir_geo, xfs_dir2_byte_to_db(mp, by));
> >  }
> >  
> >  /*
> > @@ -261,19 +261,18 @@ xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
> >   * Convert block (dablk) to block (DB)
> >   */
> >  static inline xfs_dir2_db_t
> > -xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da)
> > +xfs_dir2_da_to_db(struct xfs_da_geometry *geo, xfs_dablk_t da)
> >  {
> > -	return (xfs_dir2_db_t)(da >> mp->m_sb.sb_dirblklog);
> > +	return (xfs_dir2_db_t)(da >> (geo->blklog - geo->fsblog));
> >  }
> >  
> >  /*
> >   * Convert block (dablk) to byte offset in space
> >   */
> >  static inline xfs_dir2_off_t
> > -xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da)
> > +xfs_dir2_da_to_byte(struct xfs_da_geometry *geo, xfs_dablk_t da)
> >  {
> > -	return xfs_dir2_db_off_to_byte(mp->m_dir_geo,
> > -				       xfs_dir2_da_to_db(mp, da), 0);
> > +	return xfs_dir2_db_off_to_byte(geo, xfs_dir2_da_to_db(geo, da), 0);
> >  }
> 
> Is it a problem that we convert a dablk to a db block on the way to a
> byte conversion? i.e., that seems like a lossy conversion, assuming I am
> correctly understanding that a dablk is equivalent to a filesystem block
> and a db block is a directory block (1 or more dablks).

It's not lossy, because the only way that directory blocks are
physically indexed is by the start address of the block. That is:

sb_dirblklog = 2

db blockk index	   0               1               2
dir block map	   +---------------+---------------+
bmbt map	   +---+---+---+---+---+---+---+---+
dablk index	   0   1   2   3   4   5   6   7   8


The only time non-sb_dirblklog aligned dablk values are used are
during discontiguous buffer operations The mapping code in
xfs_dabuf_map() is the only code that needs to know about the
intermediate dablk indexes to be able to map and build the
discontiguous buffers. otherwise dablk increases by 4 counts for
every directory block and the other indexes are never directly used.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2014-05-26  4:48 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  0:03 [PATCH 00/16 V2] xfs: introduce struct xfs_da_geometry Dave Chinner
2014-05-23  0:03 ` [PATCH 01/16] xfs: introduce directory geometry structure Dave Chinner
2014-05-23 19:04   ` Brian Foster
2014-05-26  4:28     ` Dave Chinner
2014-05-26 13:29       ` Brian Foster
2014-05-26 21:39         ` Dave Chinner
2014-05-23  0:03 ` [PATCH 02/16] xfs: move directory block translatiosn to xfs_da_btree.h Dave Chinner
2014-05-23 19:05   ` Brian Foster
2014-05-27 10:46   ` Christoph Hellwig
2014-05-27 23:06     ` Dave Chinner
2014-05-28  5:28       ` Christoph Hellwig
2014-05-28  5:39         ` Dave Chinner
2014-05-23  0:03 ` [PATCH 03/16] xfs: kill XFS_DIR2...FIRSTDB macros Dave Chinner
2014-05-23 19:05   ` Brian Foster
2014-05-27 10:47   ` Christoph Hellwig
2014-05-23  0:03 ` [PATCH 04/16] xfs: convert dir byte/off conversion to xfs_da_geometry Dave Chinner
2014-05-23 19:05   ` Brian Foster
2014-05-23  0:03 ` [PATCH 05/16] xfs: convert directory dablk " Dave Chinner
2014-05-23 19:06   ` Brian Foster
2014-05-26  4:48     ` Dave Chinner [this message]
2014-05-23  0:03 ` [PATCH 06/16] xfs: convert directory db " Dave Chinner
2014-05-23 19:07   ` Brian Foster
2014-05-23  0:03 ` [PATCH 07/16] xfs: convert directory segment limits " Dave Chinner
2014-05-23 20:43   ` Brian Foster
2014-05-23  0:03 ` [PATCH 08/16] xfs: convert m_dirblkfsbs " Dave Chinner
2014-05-23 20:43   ` Brian Foster
2014-05-23  0:03 ` [PATCH 09/16] xfs: convert m_dirblksize " Dave Chinner
2014-05-27 15:59   ` Brian Foster
2014-05-23  0:03 ` [PATCH 10/16] xfs: convert dir/attr btree threshold " Dave Chinner
2014-05-27 15:59   ` Brian Foster
2014-05-23  0:03 ` [PATCH 11/16] xfs: move node entry counts " Dave Chinner
2014-05-27 15:59   ` Brian Foster
2014-05-27 23:47     ` Dave Chinner
2014-05-23  0:03 ` [PATCH 12/16] xfs: reduce direct usage of mp->m_dir_geo Dave Chinner
2014-05-27 15:59   ` Brian Foster
2014-05-27 23:53     ` Dave Chinner
2014-05-23  0:03 ` [PATCH 13/16] xfs: remove mp->m_dir_geo from directory logging Dave Chinner
2014-05-27 16:00   ` Brian Foster
2014-05-23  0:03 ` [PATCH 14/16] xfs: use xfs_da_geometry for block size in attr code Dave Chinner
2014-05-27 16:01   ` Brian Foster
2014-05-23  0:03 ` [PATCH 15/16] xfs: pass xfs_da_args to xfs_attr_leaf_newentsize Dave Chinner
2014-05-27 16:01   ` Brian Foster
2014-05-23  0:03 ` [PATCH 16/16] xfs: repalce attr LBSIZE with xfs_da_geometry Dave Chinner
2014-05-27 16:01   ` Brian Foster
  -- strict thread matches above, loose matches on Subject: below --
2014-05-28  6:04 [PATCH 00/16 V3] xfs: introduce struct xfs_da_geometry Dave Chinner
2014-05-28  6:04 ` [PATCH 05/16] xfs: convert directory dablk conversion to xfs_da_geometry 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=20140526044840.GX8554@dastard \
    --to=david@fromorbit.com \
    --cc=bfoster@redhat.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 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.