xfs
[Top] [All Lists]

Re: [PATCH 04/16] xfs: convert dir byte/off conversion to xfs_da_geometr

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 04/16] xfs: convert dir byte/off conversion to xfs_da_geometry
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Fri, 23 May 2014 15:05:36 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1400803432-20048-5-git-send-email-david@xxxxxxxxxxxxx>
References: <1400803432-20048-1-git-send-email-david@xxxxxxxxxxxxx> <1400803432-20048-5-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, May 23, 2014 at 10:03:40AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/xfs_da_btree.h     | 18 +++++++++---------
>  fs/xfs/xfs_dir2.c         |  2 +-
>  fs/xfs/xfs_dir2_readdir.c |  7 ++++---
>  3 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
> index 6d13fd6..e9496a9 100644
> --- a/fs/xfs/xfs_da_btree.h
> +++ b/fs/xfs/xfs_da_btree.h
> @@ -204,10 +204,9 @@ xfs_dir2_dataptr_to_db(struct xfs_mount *mp, 
> xfs_dir2_dataptr_t dp)
>   * Convert byte in space to offset in a block
>   */
>  static inline xfs_dir2_data_aoff_t
> -xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by)
> +xfs_dir2_byte_to_off(struct xfs_da_geometry *geo, xfs_dir2_off_t by)
>  {
> -     return (xfs_dir2_data_aoff_t)(by &
> -             ((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) - 1));
> +     return (xfs_dir2_data_aoff_t)(by & (geo->blksize - 1));
>  }
>  
>  /*
> @@ -216,18 +215,17 @@ xfs_dir2_byte_to_off(struct xfs_mount *mp, 
> xfs_dir2_off_t by)
>  static inline xfs_dir2_data_aoff_t
>  xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
>  {
> -     return xfs_dir2_byte_to_off(mp, xfs_dir2_dataptr_to_byte(dp));
> +     return xfs_dir2_byte_to_off(mp->m_dir_geo, 
> xfs_dir2_dataptr_to_byte(dp));
>  }
>  
>  /*
>   * Convert block and offset to byte in space
>   */
>  static inline xfs_dir2_off_t
> -xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
> +xfs_dir2_db_off_to_byte(struct xfs_da_geometry *geo, xfs_dir2_db_t db,
>                       xfs_dir2_data_aoff_t o)
>  {
> -     return ((xfs_dir2_off_t)db <<
> -             (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) + o;
> +     return ((xfs_dir2_off_t)db << geo->blklog) + o;
>  }
>  
>  /*
> @@ -255,7 +253,8 @@ static inline xfs_dir2_dataptr_t
>  xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
>                          xfs_dir2_data_aoff_t o)
>  {
> -     return xfs_dir2_byte_to_dataptr(xfs_dir2_db_off_to_byte(mp, db, o));
> +     return xfs_dir2_byte_to_dataptr(
> +                             xfs_dir2_db_off_to_byte(mp->m_dir_geo, db, o));
>  }
>  
>  /*
> @@ -273,7 +272,8 @@ xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da)
>  static inline xfs_dir2_off_t
>  xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da)
>  {
> -     return xfs_dir2_db_off_to_byte(mp, xfs_dir2_da_to_db(mp, da), 0);
> +     return xfs_dir2_db_off_to_byte(mp->m_dir_geo,
> +                                    xfs_dir2_da_to_db(mp, da), 0);
>  }
>  
>  /*
> diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
> index 1268dae..a7d3884 100644
> --- a/fs/xfs/xfs_dir2.c
> +++ b/fs/xfs/xfs_dir2.c
> @@ -741,7 +741,7 @@ xfs_dir2_shrink_inode(
>       /*
>        * If the block isn't the last one in the directory, we're done.
>        */
> -     if (dp->i_d.di_size > xfs_dir2_db_off_to_byte(mp, db + 1, 0))
> +     if (dp->i_d.di_size > xfs_dir2_db_off_to_byte(args->geo, db + 1, 0))
>               return 0;
>       bno = da;
>       if ((error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK))) {
> diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
> index bf7a5ce..ec912c8 100644
> --- a/fs/xfs/xfs_dir2_readdir.c
> +++ b/fs/xfs/xfs_dir2_readdir.c
> @@ -560,7 +560,8 @@ xfs_dir2_leaf_getdents(
>                       /*
>                        * Having done a read, we need to set a new offset.
>                        */
> -                     newoff = xfs_dir2_db_off_to_byte(mp, map_info->curdb, 
> 0);
> +                     newoff = xfs_dir2_db_off_to_byte(mp->m_dir_geo,
> +                                                      map_info->curdb, 0);
>                       /*
>                        * Start of the current block.
>                        */
> @@ -578,7 +579,7 @@ xfs_dir2_leaf_getdents(
>                        * Find our position in the block.
>                        */
>                       ptr = (char *)dp->d_ops->data_entry_p(hdr);
> -                     byteoff = xfs_dir2_byte_to_off(mp, curoff);
> +                     byteoff = xfs_dir2_byte_to_off(mp->m_dir_geo, curoff);
>                       /*
>                        * Skip past the header.
>                        */
> @@ -607,7 +608,7 @@ xfs_dir2_leaf_getdents(
>                                * Now set our real offset.
>                                */
>                               curoff =
> -                                     xfs_dir2_db_off_to_byte(mp,
> +                                     xfs_dir2_db_off_to_byte(mp->m_dir_geo,
>                                           xfs_dir2_byte_to_db(mp, curoff),
>                                           (char *)ptr - (char *)hdr);
>                               if (ptr >= (char *)hdr + mp->m_dirblksize) {
> -- 
> 1.9.0
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>