Commit 51842556 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: devirtualize ->leaf_hdr_from_disk

Replace the ->leaf_hdr_from_disk dir ops method with a directly called
xfs_dir2_leaf_hdr_from_disk helper that takes care of the differences
between the v4 and v5 on-disk format.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 3b344413
...@@ -643,7 +643,7 @@ xfs_da3_root_split( ...@@ -643,7 +643,7 @@ xfs_da3_root_split(
struct xfs_dir2_leaf_entry *ents; struct xfs_dir2_leaf_entry *ents;
leaf = (xfs_dir2_leaf_t *)oldroot; leaf = (xfs_dir2_leaf_t *)oldroot;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC || ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC ||
...@@ -2295,7 +2295,8 @@ xfs_da3_swap_lastblock( ...@@ -2295,7 +2295,8 @@ xfs_da3_swap_lastblock(
struct xfs_dir2_leaf_entry *ents; struct xfs_dir2_leaf_entry *ents;
dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; dead_leaf2 = (xfs_dir2_leaf_t *)dead_info;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, dead_leaf2); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr,
dead_leaf2);
ents = dp->d_ops->leaf_ents_p(dead_leaf2); ents = dp->d_ops->leaf_ents_p(dead_leaf2);
dead_level = 0; dead_level = 0;
dead_hash = be32_to_cpu(ents[leafhdr.count - 1].hashval); dead_hash = be32_to_cpu(ents[leafhdr.count - 1].hashval);
......
...@@ -430,21 +430,6 @@ xfs_dir3_leaf_ents_p(struct xfs_dir2_leaf *lp) ...@@ -430,21 +430,6 @@ xfs_dir3_leaf_ents_p(struct xfs_dir2_leaf *lp)
return ((struct xfs_dir3_leaf *)lp)->__ents; return ((struct xfs_dir3_leaf *)lp)->__ents;
} }
static void
xfs_dir2_leaf_hdr_from_disk(
struct xfs_dir3_icleaf_hdr *to,
struct xfs_dir2_leaf *from)
{
to->forw = be32_to_cpu(from->hdr.info.forw);
to->back = be32_to_cpu(from->hdr.info.back);
to->magic = be16_to_cpu(from->hdr.info.magic);
to->count = be16_to_cpu(from->hdr.count);
to->stale = be16_to_cpu(from->hdr.stale);
ASSERT(to->magic == XFS_DIR2_LEAF1_MAGIC ||
to->magic == XFS_DIR2_LEAFN_MAGIC);
}
static void static void
xfs_dir2_leaf_hdr_to_disk( xfs_dir2_leaf_hdr_to_disk(
struct xfs_dir2_leaf *to, struct xfs_dir2_leaf *to,
...@@ -460,23 +445,6 @@ xfs_dir2_leaf_hdr_to_disk( ...@@ -460,23 +445,6 @@ xfs_dir2_leaf_hdr_to_disk(
to->hdr.stale = cpu_to_be16(from->stale); to->hdr.stale = cpu_to_be16(from->stale);
} }
static void
xfs_dir3_leaf_hdr_from_disk(
struct xfs_dir3_icleaf_hdr *to,
struct xfs_dir2_leaf *from)
{
struct xfs_dir3_leaf_hdr *hdr3 = (struct xfs_dir3_leaf_hdr *)from;
to->forw = be32_to_cpu(hdr3->info.hdr.forw);
to->back = be32_to_cpu(hdr3->info.hdr.back);
to->magic = be16_to_cpu(hdr3->info.hdr.magic);
to->count = be16_to_cpu(hdr3->count);
to->stale = be16_to_cpu(hdr3->stale);
ASSERT(to->magic == XFS_DIR3_LEAF1_MAGIC ||
to->magic == XFS_DIR3_LEAFN_MAGIC);
}
static void static void
xfs_dir3_leaf_hdr_to_disk( xfs_dir3_leaf_hdr_to_disk(
struct xfs_dir2_leaf *to, struct xfs_dir2_leaf *to,
...@@ -648,7 +616,6 @@ static const struct xfs_dir_ops xfs_dir2_ops = { ...@@ -648,7 +616,6 @@ static const struct xfs_dir_ops xfs_dir2_ops = {
.leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr), .leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr),
.leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk, .leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk,
.leaf_hdr_from_disk = xfs_dir2_leaf_hdr_from_disk,
.leaf_max_ents = xfs_dir2_max_leaf_ents, .leaf_max_ents = xfs_dir2_max_leaf_ents,
.leaf_ents_p = xfs_dir2_leaf_ents_p, .leaf_ents_p = xfs_dir2_leaf_ents_p,
...@@ -693,7 +660,6 @@ static const struct xfs_dir_ops xfs_dir2_ftype_ops = { ...@@ -693,7 +660,6 @@ static const struct xfs_dir_ops xfs_dir2_ftype_ops = {
.leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr), .leaf_hdr_size = sizeof(struct xfs_dir2_leaf_hdr),
.leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk, .leaf_hdr_to_disk = xfs_dir2_leaf_hdr_to_disk,
.leaf_hdr_from_disk = xfs_dir2_leaf_hdr_from_disk,
.leaf_max_ents = xfs_dir2_max_leaf_ents, .leaf_max_ents = xfs_dir2_max_leaf_ents,
.leaf_ents_p = xfs_dir2_leaf_ents_p, .leaf_ents_p = xfs_dir2_leaf_ents_p,
...@@ -738,7 +704,6 @@ static const struct xfs_dir_ops xfs_dir3_ops = { ...@@ -738,7 +704,6 @@ static const struct xfs_dir_ops xfs_dir3_ops = {
.leaf_hdr_size = sizeof(struct xfs_dir3_leaf_hdr), .leaf_hdr_size = sizeof(struct xfs_dir3_leaf_hdr),
.leaf_hdr_to_disk = xfs_dir3_leaf_hdr_to_disk, .leaf_hdr_to_disk = xfs_dir3_leaf_hdr_to_disk,
.leaf_hdr_from_disk = xfs_dir3_leaf_hdr_from_disk,
.leaf_max_ents = xfs_dir3_max_leaf_ents, .leaf_max_ents = xfs_dir3_max_leaf_ents,
.leaf_ents_p = xfs_dir3_leaf_ents_p, .leaf_ents_p = xfs_dir3_leaf_ents_p,
......
...@@ -75,8 +75,6 @@ struct xfs_dir_ops { ...@@ -75,8 +75,6 @@ struct xfs_dir_ops {
int leaf_hdr_size; int leaf_hdr_size;
void (*leaf_hdr_to_disk)(struct xfs_dir2_leaf *to, void (*leaf_hdr_to_disk)(struct xfs_dir2_leaf *to,
struct xfs_dir3_icleaf_hdr *from); struct xfs_dir3_icleaf_hdr *from);
void (*leaf_hdr_from_disk)(struct xfs_dir3_icleaf_hdr *to,
struct xfs_dir2_leaf *from);
int (*leaf_max_ents)(struct xfs_da_geometry *geo); int (*leaf_max_ents)(struct xfs_da_geometry *geo);
struct xfs_dir2_leaf_entry * struct xfs_dir2_leaf_entry *
(*leaf_ents_p)(struct xfs_dir2_leaf *lp); (*leaf_ents_p)(struct xfs_dir2_leaf *lp);
......
...@@ -923,7 +923,7 @@ xfs_dir2_leaf_to_block( ...@@ -923,7 +923,7 @@ xfs_dir2_leaf_to_block(
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
leaf = lbp->b_addr; leaf = lbp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
......
...@@ -30,6 +30,35 @@ static void xfs_dir3_leaf_log_bests(struct xfs_da_args *args, ...@@ -30,6 +30,35 @@ static void xfs_dir3_leaf_log_bests(struct xfs_da_args *args,
static void xfs_dir3_leaf_log_tail(struct xfs_da_args *args, static void xfs_dir3_leaf_log_tail(struct xfs_da_args *args,
struct xfs_buf *bp); struct xfs_buf *bp);
void
xfs_dir2_leaf_hdr_from_disk(
struct xfs_mount *mp,
struct xfs_dir3_icleaf_hdr *to,
struct xfs_dir2_leaf *from)
{
if (xfs_sb_version_hascrc(&mp->m_sb)) {
struct xfs_dir3_leaf *from3 = (struct xfs_dir3_leaf *)from;
to->forw = be32_to_cpu(from3->hdr.info.hdr.forw);
to->back = be32_to_cpu(from3->hdr.info.hdr.back);
to->magic = be16_to_cpu(from3->hdr.info.hdr.magic);
to->count = be16_to_cpu(from3->hdr.count);
to->stale = be16_to_cpu(from3->hdr.stale);
ASSERT(to->magic == XFS_DIR3_LEAF1_MAGIC ||
to->magic == XFS_DIR3_LEAFN_MAGIC);
} else {
to->forw = be32_to_cpu(from->hdr.info.forw);
to->back = be32_to_cpu(from->hdr.info.back);
to->magic = be16_to_cpu(from->hdr.info.magic);
to->count = be16_to_cpu(from->hdr.count);
to->stale = be16_to_cpu(from->hdr.stale);
ASSERT(to->magic == XFS_DIR2_LEAF1_MAGIC ||
to->magic == XFS_DIR2_LEAFN_MAGIC);
}
}
/* /*
* Check the internal consistency of a leaf1 block. * Check the internal consistency of a leaf1 block.
* Pop an assert if something is wrong. * Pop an assert if something is wrong.
...@@ -43,7 +72,7 @@ xfs_dir3_leaf1_check( ...@@ -43,7 +72,7 @@ xfs_dir3_leaf1_check(
struct xfs_dir2_leaf *leaf = bp->b_addr; struct xfs_dir2_leaf *leaf = bp->b_addr;
struct xfs_dir3_icleaf_hdr leafhdr; struct xfs_dir3_icleaf_hdr leafhdr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
if (leafhdr.magic == XFS_DIR3_LEAF1_MAGIC) { if (leafhdr.magic == XFS_DIR3_LEAF1_MAGIC) {
struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr; struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
...@@ -96,7 +125,7 @@ xfs_dir3_leaf_check_int( ...@@ -96,7 +125,7 @@ xfs_dir3_leaf_check_int(
ops = xfs_dir_get_ops(mp, dp); ops = xfs_dir_get_ops(mp, dp);
if (!hdr) { if (!hdr) {
ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
hdr = &leafhdr; hdr = &leafhdr;
} }
...@@ -381,7 +410,7 @@ xfs_dir2_block_to_leaf( ...@@ -381,7 +410,7 @@ xfs_dir2_block_to_leaf(
/* /*
* Set the counts in the leaf header. * Set the counts in the leaf header.
*/ */
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
leafhdr.count = be32_to_cpu(btp->count); leafhdr.count = be32_to_cpu(btp->count);
leafhdr.stale = be32_to_cpu(btp->stale); leafhdr.stale = be32_to_cpu(btp->stale);
dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
...@@ -608,7 +637,7 @@ xfs_dir2_leaf_addname( ...@@ -608,7 +637,7 @@ xfs_dir2_leaf_addname(
leaf = lbp->b_addr; leaf = lbp->b_addr;
ltp = xfs_dir2_leaf_tail_p(args->geo, leaf); ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
bestsp = xfs_dir2_leaf_bests_p(ltp); bestsp = xfs_dir2_leaf_bests_p(ltp);
length = dp->d_ops->data_entsize(args->namelen); length = dp->d_ops->data_entsize(args->namelen);
...@@ -1197,7 +1226,7 @@ xfs_dir2_leaf_lookup_int( ...@@ -1197,7 +1226,7 @@ xfs_dir2_leaf_lookup_int(
leaf = lbp->b_addr; leaf = lbp->b_addr;
xfs_dir3_leaf_check(dp, lbp); xfs_dir3_leaf_check(dp, lbp);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
/* /*
* Look for the first leaf entry with our hash value. * Look for the first leaf entry with our hash value.
...@@ -1330,7 +1359,7 @@ xfs_dir2_leaf_removename( ...@@ -1330,7 +1359,7 @@ xfs_dir2_leaf_removename(
hdr = dbp->b_addr; hdr = dbp->b_addr;
xfs_dir3_data_check(dp, dbp); xfs_dir3_data_check(dp, dbp);
bf = dp->d_ops->data_bestfree_p(hdr); bf = dp->d_ops->data_bestfree_p(hdr);
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
/* /*
* Point to the leaf entry, use that to point to the data entry. * Point to the leaf entry, use that to point to the data entry.
...@@ -1511,7 +1540,7 @@ xfs_dir2_leaf_search_hash( ...@@ -1511,7 +1540,7 @@ xfs_dir2_leaf_search_hash(
leaf = lbp->b_addr; leaf = lbp->b_addr;
ents = args->dp->d_ops->leaf_ents_p(leaf); ents = args->dp->d_ops->leaf_ents_p(leaf);
args->dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(args->dp->i_mount, &leafhdr, leaf);
/* /*
* Note, the table cannot be empty, so we have to go through the loop. * Note, the table cannot be empty, so we have to go through the loop.
...@@ -1699,7 +1728,7 @@ xfs_dir2_node_to_leaf( ...@@ -1699,7 +1728,7 @@ xfs_dir2_node_to_leaf(
return 0; return 0;
lbp = state->path.blk[0].bp; lbp = state->path.blk[0].bp;
leaf = lbp->b_addr; leaf = lbp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC || ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC ||
leafhdr.magic == XFS_DIR3_LEAFN_MAGIC); leafhdr.magic == XFS_DIR3_LEAFN_MAGIC);
......
...@@ -45,7 +45,7 @@ xfs_dir3_leafn_check( ...@@ -45,7 +45,7 @@ xfs_dir3_leafn_check(
struct xfs_dir2_leaf *leaf = bp->b_addr; struct xfs_dir2_leaf *leaf = bp->b_addr;
struct xfs_dir3_icleaf_hdr leafhdr; struct xfs_dir3_icleaf_hdr leafhdr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
if (leafhdr.magic == XFS_DIR3_LEAFN_MAGIC) { if (leafhdr.magic == XFS_DIR3_LEAFN_MAGIC) {
struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr; struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
...@@ -440,7 +440,7 @@ xfs_dir2_leafn_add( ...@@ -440,7 +440,7 @@ xfs_dir2_leafn_add(
trace_xfs_dir2_leafn_add(args, index); trace_xfs_dir2_leafn_add(args, index);
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
/* /*
...@@ -538,7 +538,7 @@ xfs_dir2_leaf_lasthash( ...@@ -538,7 +538,7 @@ xfs_dir2_leaf_lasthash(
struct xfs_dir2_leaf_entry *ents; struct xfs_dir2_leaf_entry *ents;
struct xfs_dir3_icleaf_hdr leafhdr; struct xfs_dir3_icleaf_hdr leafhdr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC || ASSERT(leafhdr.magic == XFS_DIR2_LEAFN_MAGIC ||
leafhdr.magic == XFS_DIR3_LEAFN_MAGIC || leafhdr.magic == XFS_DIR3_LEAFN_MAGIC ||
...@@ -587,7 +587,7 @@ xfs_dir2_leafn_lookup_for_addname( ...@@ -587,7 +587,7 @@ xfs_dir2_leafn_lookup_for_addname(
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
leaf = bp->b_addr; leaf = bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
xfs_dir3_leaf_check(dp, bp); xfs_dir3_leaf_check(dp, bp);
...@@ -739,7 +739,7 @@ xfs_dir2_leafn_lookup_for_entry( ...@@ -739,7 +739,7 @@ xfs_dir2_leafn_lookup_for_entry(
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
leaf = bp->b_addr; leaf = bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(mp, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
xfs_dir3_leaf_check(dp, bp); xfs_dir3_leaf_check(dp, bp);
...@@ -977,8 +977,8 @@ xfs_dir2_leafn_order( ...@@ -977,8 +977,8 @@ xfs_dir2_leafn_order(
struct xfs_dir3_icleaf_hdr hdr1; struct xfs_dir3_icleaf_hdr hdr1;
struct xfs_dir3_icleaf_hdr hdr2; struct xfs_dir3_icleaf_hdr hdr2;
dp->d_ops->leaf_hdr_from_disk(&hdr1, leaf1); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &hdr1, leaf1);
dp->d_ops->leaf_hdr_from_disk(&hdr2, leaf2); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &hdr2, leaf2);
ents1 = dp->d_ops->leaf_ents_p(leaf1); ents1 = dp->d_ops->leaf_ents_p(leaf1);
ents2 = dp->d_ops->leaf_ents_p(leaf2); ents2 = dp->d_ops->leaf_ents_p(leaf2);
...@@ -1030,8 +1030,8 @@ xfs_dir2_leafn_rebalance( ...@@ -1030,8 +1030,8 @@ xfs_dir2_leafn_rebalance(
leaf1 = blk1->bp->b_addr; leaf1 = blk1->bp->b_addr;
leaf2 = blk2->bp->b_addr; leaf2 = blk2->bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&hdr1, leaf1); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &hdr1, leaf1);
dp->d_ops->leaf_hdr_from_disk(&hdr2, leaf2); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &hdr2, leaf2);
ents1 = dp->d_ops->leaf_ents_p(leaf1); ents1 = dp->d_ops->leaf_ents_p(leaf1);
ents2 = dp->d_ops->leaf_ents_p(leaf2); ents2 = dp->d_ops->leaf_ents_p(leaf2);
...@@ -1228,7 +1228,7 @@ xfs_dir2_leafn_remove( ...@@ -1228,7 +1228,7 @@ xfs_dir2_leafn_remove(
dp = args->dp; dp = args->dp;
tp = args->trans; tp = args->trans;
leaf = bp->b_addr; leaf = bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
/* /*
...@@ -1450,7 +1450,7 @@ xfs_dir2_leafn_toosmall( ...@@ -1450,7 +1450,7 @@ xfs_dir2_leafn_toosmall(
*/ */
blk = &state->path.blk[state->path.active - 1]; blk = &state->path.blk[state->path.active - 1];
leaf = blk->bp->b_addr; leaf = blk->bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &leafhdr, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
xfs_dir3_leaf_check(dp, blk->bp); xfs_dir3_leaf_check(dp, blk->bp);
...@@ -1513,7 +1513,7 @@ xfs_dir2_leafn_toosmall( ...@@ -1513,7 +1513,7 @@ xfs_dir2_leafn_toosmall(
(state->args->geo->blksize >> 2); (state->args->geo->blksize >> 2);
leaf = bp->b_addr; leaf = bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&hdr2, leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &hdr2, leaf);
ents = dp->d_ops->leaf_ents_p(leaf); ents = dp->d_ops->leaf_ents_p(leaf);
count += hdr2.count - hdr2.stale; count += hdr2.count - hdr2.stale;
bytes -= count * sizeof(ents[0]); bytes -= count * sizeof(ents[0]);
...@@ -1576,8 +1576,8 @@ xfs_dir2_leafn_unbalance( ...@@ -1576,8 +1576,8 @@ xfs_dir2_leafn_unbalance(
drop_leaf = drop_blk->bp->b_addr; drop_leaf = drop_blk->bp->b_addr;
save_leaf = save_blk->bp->b_addr; save_leaf = save_blk->bp->b_addr;
dp->d_ops->leaf_hdr_from_disk(&savehdr, save_leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &savehdr, save_leaf);
dp->d_ops->leaf_hdr_from_disk(&drophdr, drop_leaf); xfs_dir2_leaf_hdr_from_disk(dp->i_mount, &drophdr, drop_leaf);
sents = dp->d_ops->leaf_ents_p(save_leaf); sents = dp->d_ops->leaf_ents_p(save_leaf);
dents = dp->d_ops->leaf_ents_p(drop_leaf); dents = dp->d_ops->leaf_ents_p(drop_leaf);
......
...@@ -66,6 +66,8 @@ extern int xfs_dir3_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno, ...@@ -66,6 +66,8 @@ extern int xfs_dir3_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
struct xfs_buf **bpp); struct xfs_buf **bpp);
/* xfs_dir2_leaf.c */ /* xfs_dir2_leaf.c */
void xfs_dir2_leaf_hdr_from_disk(struct xfs_mount *mp,
struct xfs_dir3_icleaf_hdr *to, struct xfs_dir2_leaf *from);
extern int xfs_dir3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t fbno, xfs_daddr_t mappedbno, struct xfs_buf **bpp); xfs_dablk_t fbno, xfs_daddr_t mappedbno, struct xfs_buf **bpp);
extern int xfs_dir3_leafn_read(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir3_leafn_read(struct xfs_trans *tp, struct xfs_inode *dp,
......
...@@ -507,7 +507,7 @@ xchk_directory_leaf1_bestfree( ...@@ -507,7 +507,7 @@ xchk_directory_leaf1_bestfree(
xchk_buffer_recheck(sc, bp); xchk_buffer_recheck(sc, bp);
leaf = bp->b_addr; leaf = bp->b_addr;
d_ops->leaf_hdr_from_disk(&leafhdr, leaf); xfs_dir2_leaf_hdr_from_disk(sc->ip->i_mount, &leafhdr, leaf);
ents = d_ops->leaf_ents_p(leaf); ents = d_ops->leaf_ents_p(leaf);
ltp = xfs_dir2_leaf_tail_p(geo, leaf); ltp = xfs_dir2_leaf_tail_p(geo, leaf);
bestcount = be32_to_cpu(ltp->bestcount); bestcount = be32_to_cpu(ltp->bestcount);
......
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