Commit 8c44a285 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: kill XFS_DIR2...FIRSTDB macros

They are just simple wrappers around xfs_dir2_byte_to_db(), and
we've already removed one usage earlier in the patch set. Kill
the rest before we start removing the xfs_mount from conversion
functions.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>

parent 892e3f34
...@@ -611,7 +611,8 @@ xfs_dir2_free_bests_p(struct xfs_dir2_free *free) ...@@ -611,7 +611,8 @@ xfs_dir2_free_bests_p(struct xfs_dir2_free *free)
static xfs_dir2_db_t static xfs_dir2_db_t
xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db) xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db)
{ {
return XFS_DIR2_FREE_FIRSTDB(mp) + db / xfs_dir2_free_max_bests(mp); return xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET) +
(db / xfs_dir2_free_max_bests(mp));
} }
/* /*
...@@ -642,7 +643,8 @@ xfs_dir3_free_bests_p(struct xfs_dir2_free *free) ...@@ -642,7 +643,8 @@ xfs_dir3_free_bests_p(struct xfs_dir2_free *free)
static xfs_dir2_db_t static xfs_dir2_db_t
xfs_dir3_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db) xfs_dir3_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db)
{ {
return XFS_DIR2_FREE_FIRSTDB(mp) + db / xfs_dir3_free_max_bests(mp); return xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET) +
(db / xfs_dir3_free_max_bests(mp));
} }
/* /*
......
...@@ -330,8 +330,6 @@ xfs_dir2_sf_firstentry(struct xfs_dir2_sf_hdr *hdr) ...@@ -330,8 +330,6 @@ xfs_dir2_sf_firstentry(struct xfs_dir2_sf_hdr *hdr)
#define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG)) #define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG))
#define XFS_DIR2_DATA_SPACE 0 #define XFS_DIR2_DATA_SPACE 0
#define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE) #define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE)
#define XFS_DIR2_DATA_FIRSTDB(mp) \
xfs_dir2_byte_to_db(mp, XFS_DIR2_DATA_OFFSET)
/* /*
* Describe a free area in the data block. * Describe a free area in the data block.
...@@ -456,8 +454,6 @@ xfs_dir2_data_unused_tag_p(struct xfs_dir2_data_unused *dup) ...@@ -456,8 +454,6 @@ xfs_dir2_data_unused_tag_p(struct xfs_dir2_data_unused *dup)
*/ */
#define XFS_DIR2_LEAF_SPACE 1 #define XFS_DIR2_LEAF_SPACE 1
#define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE) #define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)
#define XFS_DIR2_LEAF_FIRSTDB(mp) \
xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET)
/* /*
* Leaf block header. * Leaf block header.
...@@ -531,8 +527,6 @@ xfs_dir2_leaf_bests_p(struct xfs_dir2_leaf_tail *ltp) ...@@ -531,8 +527,6 @@ xfs_dir2_leaf_bests_p(struct xfs_dir2_leaf_tail *ltp)
*/ */
#define XFS_DIR2_FREE_SPACE 2 #define XFS_DIR2_FREE_SPACE 2
#define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE) #define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)
#define XFS_DIR2_FREE_FIRSTDB(mp) \
xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET)
typedef struct xfs_dir2_free_hdr { typedef struct xfs_dir2_free_hdr {
__be32 magic; /* XFS_DIR2_FREE_MAGIC */ __be32 magic; /* XFS_DIR2_FREE_MAGIC */
......
...@@ -744,7 +744,7 @@ xfs_dir2_shrink_inode( ...@@ -744,7 +744,7 @@ xfs_dir2_shrink_inode(
/* /*
* If it's not a data block, we're done. * If it's not a data block, we're done.
*/ */
if (db >= XFS_DIR2_LEAF_FIRSTDB(mp)) if (db >= xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET))
return 0; return 0;
/* /*
* If the block isn't the last one in the directory, we're done. * If the block isn't the last one in the directory, we're done.
......
...@@ -347,8 +347,8 @@ xfs_dir3_leaf_get_buf( ...@@ -347,8 +347,8 @@ xfs_dir3_leaf_get_buf(
int error; int error;
ASSERT(magic == XFS_DIR2_LEAF1_MAGIC || magic == XFS_DIR2_LEAFN_MAGIC); ASSERT(magic == XFS_DIR2_LEAF1_MAGIC || magic == XFS_DIR2_LEAFN_MAGIC);
ASSERT(bno >= XFS_DIR2_LEAF_FIRSTDB(mp) && ASSERT(bno >= xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET) &&
bno < XFS_DIR2_FREE_FIRSTDB(mp)); bno < xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET));
error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, bno), -1, &bp, error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, bno), -1, &bp,
XFS_DATA_FORK); XFS_DATA_FORK);
...@@ -404,7 +404,7 @@ xfs_dir2_block_to_leaf( ...@@ -404,7 +404,7 @@ xfs_dir2_block_to_leaf(
return error; return error;
} }
ldb = xfs_dir2_da_to_db(mp, blkno); ldb = xfs_dir2_da_to_db(mp, blkno);
ASSERT(ldb == XFS_DIR2_LEAF_FIRSTDB(mp)); ASSERT(ldb == xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET));
/* /*
* Initialize the leaf block, get a buffer for it. * Initialize the leaf block, get a buffer for it.
*/ */
...@@ -1798,7 +1798,8 @@ xfs_dir2_node_to_leaf( ...@@ -1798,7 +1798,8 @@ xfs_dir2_node_to_leaf(
/* /*
* Get rid of the freespace block. * Get rid of the freespace block.
*/ */
error = xfs_dir2_shrink_inode(args, XFS_DIR2_FREE_FIRSTDB(mp), fbp); error = xfs_dir2_shrink_inode(args,
xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET), fbp);
if (error) { if (error) {
/* /*
* This can't fail here because it can only happen when * This can't fail here because it can only happen when
......
...@@ -315,7 +315,7 @@ xfs_dir2_leaf_to_node( ...@@ -315,7 +315,7 @@ xfs_dir2_leaf_to_node(
if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, &fdb))) { if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, &fdb))) {
return error; return error;
} }
ASSERT(fdb == XFS_DIR2_FREE_FIRSTDB(mp)); ASSERT(fdb == xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET));
/* /*
* Get the buffer for the new freespace block. * Get the buffer for the new freespace block.
*/ */
...@@ -1256,7 +1256,7 @@ xfs_dir2_leafn_remove( ...@@ -1256,7 +1256,7 @@ xfs_dir2_leafn_remove(
struct xfs_dir3_icfree_hdr freehdr; struct xfs_dir3_icfree_hdr freehdr;
dp->d_ops->free_hdr_from_disk(&freehdr, free); dp->d_ops->free_hdr_from_disk(&freehdr, free);
ASSERT(freehdr.firstdb == dp->d_ops->free_max_bests(mp) * ASSERT(freehdr.firstdb == dp->d_ops->free_max_bests(mp) *
(fdb - XFS_DIR2_FREE_FIRSTDB(mp))); (fdb - xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET)));
} }
#endif #endif
/* /*
...@@ -1747,7 +1747,8 @@ xfs_dir2_node_addname_int( ...@@ -1747,7 +1747,8 @@ xfs_dir2_node_addname_int(
* us a freespace block to start with. * us a freespace block to start with.
*/ */
if (++fbno == 0) if (++fbno == 0)
fbno = XFS_DIR2_FREE_FIRSTDB(mp); fbno = xfs_dir2_byte_to_db(mp,
XFS_DIR2_FREE_OFFSET);
/* /*
* If it's ifbno we already looked at it. * If it's ifbno we already looked at it.
*/ */
...@@ -1887,7 +1888,9 @@ xfs_dir2_node_addname_int( ...@@ -1887,7 +1888,9 @@ xfs_dir2_node_addname_int(
/* /*
* Remember the first slot as our empty slot. * Remember the first slot as our empty slot.
*/ */
freehdr.firstdb = (fbno - XFS_DIR2_FREE_FIRSTDB(mp)) * freehdr.firstdb =
(fbno - xfs_dir2_byte_to_db(mp,
XFS_DIR2_FREE_OFFSET)) *
dp->d_ops->free_max_bests(mp); dp->d_ops->free_max_bests(mp);
} else { } else {
free = fbp->b_addr; free = fbp->b_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment