summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_dir2_priv.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-06-06 09:06:53 +0400
committerDave Chinner <david@fromorbit.com>2014-06-06 09:06:53 +0400
commit9b3b5522d3f55215ce51c87b0467926c57a6f182 (patch)
treedf132e36493de332a7435211d5b982fcc9049445 /fs/xfs/xfs_dir2_priv.h
parent8c44a28561625d36591cc1540eb5f9033a9d1815 (diff)
downloadlinux-9b3b5522d3f55215ce51c87b0467926c57a6f182.tar.xz
xfs: convert dir byte/off conversion to xfs_da_geometry
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_priv.h')
-rw-r--r--fs/xfs/xfs_dir2_priv.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/xfs/xfs_dir2_priv.h b/fs/xfs/xfs_dir2_priv.h
index 492edb6e07a7..683828942de1 100644
--- a/fs/xfs/xfs_dir2_priv.h
+++ b/fs/xfs/xfs_dir2_priv.h
@@ -67,10 +67,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));
}
/*
@@ -79,18 +78,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;
}
/*
@@ -118,7 +116,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));
}
/*
@@ -136,7 +135,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);
}
/*