Commit bc85178a authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: remove mp->m_dir_geo from directory logging

We don't pass the xfs_da_args or the geometry all the way down to
the directory buffer logging code, hence we have to use
mp->m_dir_geo here. Fix this to use the geometry passed via the
xfs_da_args, and convert all the directory logging functions for
consistency.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 53f82db0
...@@ -153,16 +153,16 @@ extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, ...@@ -153,16 +153,16 @@ extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
extern void xfs_dir2_data_freescan(struct xfs_inode *dp, extern void xfs_dir2_data_freescan(struct xfs_inode *dp,
struct xfs_dir2_data_hdr *hdr, int *loghead); struct xfs_dir2_data_hdr *hdr, int *loghead);
extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_inode *dp, extern void xfs_dir2_data_log_entry(struct xfs_da_args *args,
struct xfs_buf *bp, struct xfs_dir2_data_entry *dep); struct xfs_buf *bp, struct xfs_dir2_data_entry *dep);
extern void xfs_dir2_data_log_header(struct xfs_trans *tp, struct xfs_inode *dp, extern void xfs_dir2_data_log_header(struct xfs_da_args *args,
struct xfs_buf *bp); struct xfs_buf *bp);
extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp, extern void xfs_dir2_data_log_unused(struct xfs_da_args *args,
struct xfs_dir2_data_unused *dup); struct xfs_buf *bp, struct xfs_dir2_data_unused *dup);
extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_inode *dp, extern void xfs_dir2_data_make_free(struct xfs_da_args *args,
struct xfs_buf *bp, xfs_dir2_data_aoff_t offset, struct xfs_buf *bp, xfs_dir2_data_aoff_t offset,
xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp); xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_inode *dp, extern void xfs_dir2_data_use_free(struct xfs_da_args *args,
struct xfs_buf *bp, struct xfs_dir2_data_unused *dup, struct xfs_buf *bp, struct xfs_dir2_data_unused *dup,
xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len, xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
int *needlogp, int *needscanp); int *needlogp, int *needscanp);
......
...@@ -281,8 +281,7 @@ xfs_dir2_block_need_space( ...@@ -281,8 +281,7 @@ xfs_dir2_block_need_space(
*/ */
static void static void
xfs_dir2_block_compact( xfs_dir2_block_compact(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp, struct xfs_buf *bp,
struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_hdr *hdr,
struct xfs_dir2_block_tail *btp, struct xfs_dir2_block_tail *btp,
...@@ -315,7 +314,7 @@ xfs_dir2_block_compact( ...@@ -315,7 +314,7 @@ xfs_dir2_block_compact(
*lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1);
*lfloghigh -= be32_to_cpu(btp->stale) - 1; *lfloghigh -= be32_to_cpu(btp->stale) - 1;
be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1)); be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1));
xfs_dir2_data_make_free(tp, dp, bp, xfs_dir2_data_make_free(args, bp,
(xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr),
(xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)), (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)),
needlog, &needscan); needlog, &needscan);
...@@ -325,7 +324,7 @@ xfs_dir2_block_compact( ...@@ -325,7 +324,7 @@ xfs_dir2_block_compact(
* This needs to happen before the next call to use_free. * This needs to happen before the next call to use_free.
*/ */
if (needscan) if (needscan)
xfs_dir2_data_freescan(dp, hdr, needlog); xfs_dir2_data_freescan(args->dp, hdr, needlog);
} }
/* /*
...@@ -420,7 +419,7 @@ xfs_dir2_block_addname( ...@@ -420,7 +419,7 @@ xfs_dir2_block_addname(
* If need to compact the leaf entries, do it now. * If need to compact the leaf entries, do it now.
*/ */
if (compact) { if (compact) {
xfs_dir2_block_compact(tp, dp, bp, hdr, btp, blp, &needlog, xfs_dir2_block_compact(args, bp, hdr, btp, blp, &needlog,
&lfloghigh, &lfloglow); &lfloghigh, &lfloglow);
/* recalculate blp post-compaction */ /* recalculate blp post-compaction */
blp = xfs_dir2_block_leaf_p(btp); blp = xfs_dir2_block_leaf_p(btp);
...@@ -455,7 +454,7 @@ xfs_dir2_block_addname( ...@@ -455,7 +454,7 @@ xfs_dir2_block_addname(
/* /*
* Mark the space needed for the new leaf entry, now in use. * Mark the space needed for the new leaf entry, now in use.
*/ */
xfs_dir2_data_use_free(tp, dp, bp, enddup, xfs_dir2_data_use_free(args, bp, enddup,
(xfs_dir2_data_aoff_t) (xfs_dir2_data_aoff_t)
((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) - ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) -
sizeof(*blp)), sizeof(*blp)),
...@@ -542,7 +541,7 @@ xfs_dir2_block_addname( ...@@ -542,7 +541,7 @@ xfs_dir2_block_addname(
/* /*
* Mark space for the data entry used. * Mark space for the data entry used.
*/ */
xfs_dir2_data_use_free(tp, dp, bp, dup, xfs_dir2_data_use_free(args, bp, dup,
(xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr),
(xfs_dir2_data_aoff_t)len, &needlog, &needscan); (xfs_dir2_data_aoff_t)len, &needlog, &needscan);
/* /*
...@@ -560,9 +559,9 @@ xfs_dir2_block_addname( ...@@ -560,9 +559,9 @@ xfs_dir2_block_addname(
if (needscan) if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog); xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, bp); xfs_dir2_data_log_header(args, bp);
xfs_dir2_block_log_tail(tp, bp); xfs_dir2_block_log_tail(tp, bp);
xfs_dir2_data_log_entry(tp, dp, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
xfs_dir3_data_check(dp, bp); xfs_dir3_data_check(dp, bp);
return 0; return 0;
} }
...@@ -803,7 +802,7 @@ xfs_dir2_block_removename( ...@@ -803,7 +802,7 @@ xfs_dir2_block_removename(
* Mark the data entry's space free. * Mark the data entry's space free.
*/ */
needlog = needscan = 0; needlog = needscan = 0;
xfs_dir2_data_make_free(tp, dp, bp, xfs_dir2_data_make_free(args, bp,
(xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
/* /*
...@@ -822,7 +821,7 @@ xfs_dir2_block_removename( ...@@ -822,7 +821,7 @@ xfs_dir2_block_removename(
if (needscan) if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog); xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, bp); xfs_dir2_data_log_header(args, bp);
xfs_dir3_data_check(dp, bp); xfs_dir3_data_check(dp, bp);
/* /*
* See if the size as a shortform is good enough. * See if the size as a shortform is good enough.
...@@ -881,7 +880,7 @@ xfs_dir2_block_replace( ...@@ -881,7 +880,7 @@ xfs_dir2_block_replace(
*/ */
dep->inumber = cpu_to_be64(args->inumber); dep->inumber = cpu_to_be64(args->inumber);
dp->d_ops->data_put_ftype(dep, args->filetype); dp->d_ops->data_put_ftype(dep, args->filetype);
xfs_dir2_data_log_entry(args->trans, dp, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
xfs_dir3_data_check(dp, bp); xfs_dir3_data_check(dp, bp);
return 0; return 0;
} }
...@@ -1004,7 +1003,7 @@ xfs_dir2_leaf_to_block( ...@@ -1004,7 +1003,7 @@ xfs_dir2_leaf_to_block(
/* /*
* Use up the space at the end of the block (blp/btp). * Use up the space at the end of the block (blp/btp).
*/ */
xfs_dir2_data_use_free(tp, dp, dbp, dup, args->geo->blksize - size, size, xfs_dir2_data_use_free(args, dbp, dup, args->geo->blksize - size, size,
&needlog, &needscan); &needlog, &needscan);
/* /*
* Initialize the block tail. * Initialize the block tail.
...@@ -1030,7 +1029,7 @@ xfs_dir2_leaf_to_block( ...@@ -1030,7 +1029,7 @@ xfs_dir2_leaf_to_block(
if (needscan) if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog); xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, dbp); xfs_dir2_data_log_header(args, dbp);
/* /*
* Pitch the old leaf block. * Pitch the old leaf block.
*/ */
...@@ -1143,7 +1142,7 @@ xfs_dir2_sf_to_block( ...@@ -1143,7 +1142,7 @@ xfs_dir2_sf_to_block(
*/ */
dup = dp->d_ops->data_unused_p(hdr); dup = dp->d_ops->data_unused_p(hdr);
needlog = needscan = 0; needlog = needscan = 0;
xfs_dir2_data_use_free(tp, dp, bp, dup, args->geo->blksize - i, xfs_dir2_data_use_free(args, bp, dup, args->geo->blksize - i,
i, &needlog, &needscan); i, &needlog, &needscan);
ASSERT(needscan == 0); ASSERT(needscan == 0);
/* /*
...@@ -1157,7 +1156,7 @@ xfs_dir2_sf_to_block( ...@@ -1157,7 +1156,7 @@ xfs_dir2_sf_to_block(
/* /*
* Remove the freespace, we'll manage it. * Remove the freespace, we'll manage it.
*/ */
xfs_dir2_data_use_free(tp, dp, bp, dup, xfs_dir2_data_use_free(args, bp, dup,
(xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr),
be16_to_cpu(dup->length), &needlog, &needscan); be16_to_cpu(dup->length), &needlog, &needscan);
/* /*
...@@ -1170,7 +1169,7 @@ xfs_dir2_sf_to_block( ...@@ -1170,7 +1169,7 @@ xfs_dir2_sf_to_block(
dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR);
tagp = dp->d_ops->data_entry_tag_p(dep); tagp = dp->d_ops->data_entry_tag_p(dep);
*tagp = cpu_to_be16((char *)dep - (char *)hdr); *tagp = cpu_to_be16((char *)dep - (char *)hdr);
xfs_dir2_data_log_entry(tp, dp, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
(char *)dep - (char *)hdr)); (char *)dep - (char *)hdr));
...@@ -1184,7 +1183,7 @@ xfs_dir2_sf_to_block( ...@@ -1184,7 +1183,7 @@ xfs_dir2_sf_to_block(
dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR);
tagp = dp->d_ops->data_entry_tag_p(dep); tagp = dp->d_ops->data_entry_tag_p(dep);
*tagp = cpu_to_be16((char *)dep - (char *)hdr); *tagp = cpu_to_be16((char *)dep - (char *)hdr);
xfs_dir2_data_log_entry(tp, dp, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
(char *)dep - (char *)hdr)); (char *)dep - (char *)hdr));
...@@ -1218,7 +1217,7 @@ xfs_dir2_sf_to_block( ...@@ -1218,7 +1217,7 @@ xfs_dir2_sf_to_block(
dup->length = cpu_to_be16(newoffset - offset); dup->length = cpu_to_be16(newoffset - offset);
*xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16( *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16(
((char *)dup - (char *)hdr)); ((char *)dup - (char *)hdr));
xfs_dir2_data_log_unused(tp, bp, dup); xfs_dir2_data_log_unused(args, bp, dup);
xfs_dir2_data_freeinsert(hdr, xfs_dir2_data_freeinsert(hdr,
dp->d_ops->data_bestfree_p(hdr), dp->d_ops->data_bestfree_p(hdr),
dup, &dummy); dup, &dummy);
...@@ -1235,7 +1234,7 @@ xfs_dir2_sf_to_block( ...@@ -1235,7 +1234,7 @@ xfs_dir2_sf_to_block(
memcpy(dep->name, sfep->name, dep->namelen); memcpy(dep->name, sfep->name, dep->namelen);
tagp = dp->d_ops->data_entry_tag_p(dep); tagp = dp->d_ops->data_entry_tag_p(dep);
*tagp = cpu_to_be16((char *)dep - (char *)hdr); *tagp = cpu_to_be16((char *)dep - (char *)hdr);
xfs_dir2_data_log_entry(tp, dp, bp, dep); xfs_dir2_data_log_entry(args, bp, dep);
name.name = sfep->name; name.name = sfep->name;
name.len = sfep->namelen; name.len = sfep->namelen;
blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops->
......
...@@ -630,8 +630,8 @@ xfs_dir3_data_init( ...@@ -630,8 +630,8 @@ xfs_dir3_data_init(
/* /*
* Log it and return it. * Log it and return it.
*/ */
xfs_dir2_data_log_header(tp, dp, bp); xfs_dir2_data_log_header(args, bp);
xfs_dir2_data_log_unused(tp, bp, dup); xfs_dir2_data_log_unused(args, bp, dup);
*bpp = bp; *bpp = bp;
return 0; return 0;
} }
...@@ -641,8 +641,7 @@ xfs_dir3_data_init( ...@@ -641,8 +641,7 @@ xfs_dir3_data_init(
*/ */
void void
xfs_dir2_data_log_entry( xfs_dir2_data_log_entry(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp, struct xfs_buf *bp,
xfs_dir2_data_entry_t *dep) /* data entry pointer */ xfs_dir2_data_entry_t *dep) /* data entry pointer */
{ {
...@@ -653,8 +652,8 @@ xfs_dir2_data_log_entry( ...@@ -653,8 +652,8 @@ xfs_dir2_data_log_entry(
hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr), xfs_trans_log_buf(args->trans, bp, (uint)((char *)dep - (char *)hdr),
(uint)((char *)(dp->d_ops->data_entry_tag_p(dep) + 1) - (uint)((char *)(args->dp->d_ops->data_entry_tag_p(dep) + 1) -
(char *)hdr - 1)); (char *)hdr - 1));
} }
...@@ -663,8 +662,7 @@ xfs_dir2_data_log_entry( ...@@ -663,8 +662,7 @@ xfs_dir2_data_log_entry(
*/ */
void void
xfs_dir2_data_log_header( xfs_dir2_data_log_header(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -676,7 +674,8 @@ xfs_dir2_data_log_header( ...@@ -676,7 +674,8 @@ xfs_dir2_data_log_header(
hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
#endif #endif
xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset - 1); xfs_trans_log_buf(args->trans, bp, 0,
args->dp->d_ops->data_entry_offset - 1);
} }
/* /*
...@@ -684,7 +683,7 @@ xfs_dir2_data_log_header( ...@@ -684,7 +683,7 @@ xfs_dir2_data_log_header(
*/ */
void void
xfs_dir2_data_log_unused( xfs_dir2_data_log_unused(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_buf *bp, struct xfs_buf *bp,
xfs_dir2_data_unused_t *dup) /* data unused pointer */ xfs_dir2_data_unused_t *dup) /* data unused pointer */
{ {
...@@ -698,13 +697,13 @@ xfs_dir2_data_log_unused( ...@@ -698,13 +697,13 @@ xfs_dir2_data_log_unused(
/* /*
* Log the first part of the unused entry. * Log the first part of the unused entry.
*/ */
xfs_trans_log_buf(tp, bp, (uint)((char *)dup - (char *)hdr), xfs_trans_log_buf(args->trans, bp, (uint)((char *)dup - (char *)hdr),
(uint)((char *)&dup->length + sizeof(dup->length) - (uint)((char *)&dup->length + sizeof(dup->length) -
1 - (char *)hdr)); 1 - (char *)hdr));
/* /*
* Log the end (tag) of the unused entry. * Log the end (tag) of the unused entry.
*/ */
xfs_trans_log_buf(tp, bp, xfs_trans_log_buf(args->trans, bp,
(uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr), (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr),
(uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr + (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr +
sizeof(xfs_dir2_data_off_t) - 1)); sizeof(xfs_dir2_data_off_t) - 1));
...@@ -716,8 +715,7 @@ xfs_dir2_data_log_unused( ...@@ -716,8 +715,7 @@ xfs_dir2_data_log_unused(
*/ */
void void
xfs_dir2_data_make_free( xfs_dir2_data_make_free(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp, struct xfs_buf *bp,
xfs_dir2_data_aoff_t offset, /* starting byte offset */ xfs_dir2_data_aoff_t offset, /* starting byte offset */
xfs_dir2_data_aoff_t len, /* length in bytes */ xfs_dir2_data_aoff_t len, /* length in bytes */
...@@ -727,37 +725,33 @@ xfs_dir2_data_make_free( ...@@ -727,37 +725,33 @@ xfs_dir2_data_make_free(
xfs_dir2_data_hdr_t *hdr; /* data block pointer */ xfs_dir2_data_hdr_t *hdr; /* data block pointer */
xfs_dir2_data_free_t *dfp; /* bestfree pointer */ xfs_dir2_data_free_t *dfp; /* bestfree pointer */
char *endptr; /* end of data area */ char *endptr; /* end of data area */
xfs_mount_t *mp; /* filesystem mount point */
int needscan; /* need to regen bestfree */ int needscan; /* need to regen bestfree */
xfs_dir2_data_unused_t *newdup; /* new unused entry */ xfs_dir2_data_unused_t *newdup; /* new unused entry */
xfs_dir2_data_unused_t *postdup; /* unused entry after us */ xfs_dir2_data_unused_t *postdup; /* unused entry after us */
xfs_dir2_data_unused_t *prevdup; /* unused entry before us */ xfs_dir2_data_unused_t *prevdup; /* unused entry before us */
struct xfs_dir2_data_free *bf; struct xfs_dir2_data_free *bf;
struct xfs_da_geometry *geo;
mp = tp->t_mountp;
hdr = bp->b_addr; hdr = bp->b_addr;
geo = mp->m_dir_geo;
/* /*
* Figure out where the end of the data area is. * Figure out where the end of the data area is.
*/ */
if (hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || if (hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)) hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC))
endptr = (char *)hdr + geo->blksize; endptr = (char *)hdr + args->geo->blksize;
else { else {
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
btp = xfs_dir2_block_tail_p(geo, hdr); btp = xfs_dir2_block_tail_p(args->geo, hdr);
endptr = (char *)xfs_dir2_block_leaf_p(btp); endptr = (char *)xfs_dir2_block_leaf_p(btp);
} }
/* /*
* If this isn't the start of the block, then back up to * If this isn't the start of the block, then back up to
* the previous entry and see if it's free. * the previous entry and see if it's free.
*/ */
if (offset > dp->d_ops->data_entry_offset) { if (offset > args->dp->d_ops->data_entry_offset) {
__be16 *tagp; /* tag just before us */ __be16 *tagp; /* tag just before us */
tagp = (__be16 *)((char *)hdr + offset) - 1; tagp = (__be16 *)((char *)hdr + offset) - 1;
...@@ -783,7 +777,7 @@ xfs_dir2_data_make_free( ...@@ -783,7 +777,7 @@ xfs_dir2_data_make_free(
* Previous and following entries are both free, * Previous and following entries are both free,
* merge everything into a single free entry. * merge everything into a single free entry.
*/ */
bf = dp->d_ops->data_bestfree_p(hdr); bf = args->dp->d_ops->data_bestfree_p(hdr);
if (prevdup && postdup) { if (prevdup && postdup) {
xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */ xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */
...@@ -805,7 +799,7 @@ xfs_dir2_data_make_free( ...@@ -805,7 +799,7 @@ xfs_dir2_data_make_free(
be16_add_cpu(&prevdup->length, len + be16_to_cpu(postdup->length)); be16_add_cpu(&prevdup->length, len + be16_to_cpu(postdup->length));
*xfs_dir2_data_unused_tag_p(prevdup) = *xfs_dir2_data_unused_tag_p(prevdup) =
cpu_to_be16((char *)prevdup - (char *)hdr); cpu_to_be16((char *)prevdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, prevdup); xfs_dir2_data_log_unused(args, bp, prevdup);
if (!needscan) { if (!needscan) {
/* /*
* Has to be the case that entries 0 and 1 are * Has to be the case that entries 0 and 1 are
...@@ -840,7 +834,7 @@ xfs_dir2_data_make_free( ...@@ -840,7 +834,7 @@ xfs_dir2_data_make_free(
be16_add_cpu(&prevdup->length, len); be16_add_cpu(&prevdup->length, len);
*xfs_dir2_data_unused_tag_p(prevdup) = *xfs_dir2_data_unused_tag_p(prevdup) =
cpu_to_be16((char *)prevdup - (char *)hdr); cpu_to_be16((char *)prevdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, prevdup); xfs_dir2_data_log_unused(args, bp, prevdup);
/* /*
* If the previous entry was in the table, the new entry * If the previous entry was in the table, the new entry
* is longer, so it will be in the table too. Remove * is longer, so it will be in the table too. Remove
...@@ -868,7 +862,7 @@ xfs_dir2_data_make_free( ...@@ -868,7 +862,7 @@ xfs_dir2_data_make_free(
newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
*xfs_dir2_data_unused_tag_p(newdup) = *xfs_dir2_data_unused_tag_p(newdup) =
cpu_to_be16((char *)newdup - (char *)hdr); cpu_to_be16((char *)newdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(args, bp, newdup);
/* /*
* If the following entry was in the table, the new entry * If the following entry was in the table, the new entry
* is longer, so it will be in the table too. Remove * is longer, so it will be in the table too. Remove
...@@ -895,7 +889,7 @@ xfs_dir2_data_make_free( ...@@ -895,7 +889,7 @@ xfs_dir2_data_make_free(
newdup->length = cpu_to_be16(len); newdup->length = cpu_to_be16(len);
*xfs_dir2_data_unused_tag_p(newdup) = *xfs_dir2_data_unused_tag_p(newdup) =
cpu_to_be16((char *)newdup - (char *)hdr); cpu_to_be16((char *)newdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(args, bp, newdup);
xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp); xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp);
} }
*needscanp = needscan; *needscanp = needscan;
...@@ -906,8 +900,7 @@ xfs_dir2_data_make_free( ...@@ -906,8 +900,7 @@ xfs_dir2_data_make_free(
*/ */
void void
xfs_dir2_data_use_free( xfs_dir2_data_use_free(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp, struct xfs_buf *bp,
xfs_dir2_data_unused_t *dup, /* unused entry */ xfs_dir2_data_unused_t *dup, /* unused entry */
xfs_dir2_data_aoff_t offset, /* starting offset to use */ xfs_dir2_data_aoff_t offset, /* starting offset to use */
...@@ -938,7 +931,7 @@ xfs_dir2_data_use_free( ...@@ -938,7 +931,7 @@ xfs_dir2_data_use_free(
* Look up the entry in the bestfree table. * Look up the entry in the bestfree table.
*/ */
oldlen = be16_to_cpu(dup->length); oldlen = be16_to_cpu(dup->length);
bf = dp->d_ops->data_bestfree_p(hdr); bf = args->dp->d_ops->data_bestfree_p(hdr);
dfp = xfs_dir2_data_freefind(hdr, bf, dup); dfp = xfs_dir2_data_freefind(hdr, bf, dup);
ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length)); ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length));
/* /*
...@@ -970,7 +963,7 @@ xfs_dir2_data_use_free( ...@@ -970,7 +963,7 @@ xfs_dir2_data_use_free(
newdup->length = cpu_to_be16(oldlen - len); newdup->length = cpu_to_be16(oldlen - len);
*xfs_dir2_data_unused_tag_p(newdup) = *xfs_dir2_data_unused_tag_p(newdup) =
cpu_to_be16((char *)newdup - (char *)hdr); cpu_to_be16((char *)newdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(args, bp, newdup);
/* /*
* If it was in the table, remove it and add the new one. * If it was in the table, remove it and add the new one.
*/ */
...@@ -998,7 +991,7 @@ xfs_dir2_data_use_free( ...@@ -998,7 +991,7 @@ xfs_dir2_data_use_free(
newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup); newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup);
*xfs_dir2_data_unused_tag_p(newdup) = *xfs_dir2_data_unused_tag_p(newdup) =
cpu_to_be16((char *)newdup - (char *)hdr); cpu_to_be16((char *)newdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(args, bp, newdup);
/* /*
* If it was in the table, remove it and add the new one. * If it was in the table, remove it and add the new one.
*/ */
...@@ -1026,13 +1019,13 @@ xfs_dir2_data_use_free( ...@@ -1026,13 +1019,13 @@ xfs_dir2_data_use_free(
newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup); newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup);
*xfs_dir2_data_unused_tag_p(newdup) = *xfs_dir2_data_unused_tag_p(newdup) =
cpu_to_be16((char *)newdup - (char *)hdr); cpu_to_be16((char *)newdup - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, newdup); xfs_dir2_data_log_unused(args, bp, newdup);
newdup2 = (xfs_dir2_data_unused_t *)((char *)hdr + offset + len); newdup2 = (xfs_dir2_data_unused_t *)((char *)hdr + offset + len);
newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length)); newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length));
*xfs_dir2_data_unused_tag_p(newdup2) = *xfs_dir2_data_unused_tag_p(newdup2) =
cpu_to_be16((char *)newdup2 - (char *)hdr); cpu_to_be16((char *)newdup2 - (char *)hdr);
xfs_dir2_data_log_unused(tp, bp, newdup2); xfs_dir2_data_log_unused(args, bp, newdup2);
/* /*
* If the old entry was in the table, we need to scan * If the old entry was in the table, we need to scan
* if the 3rd entry was valid, since these entries * if the 3rd entry was valid, since these entries
......
...@@ -41,9 +41,10 @@ ...@@ -41,9 +41,10 @@
*/ */
static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp, static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp,
int *indexp, struct xfs_buf **dbpp); int *indexp, struct xfs_buf **dbpp);
static void xfs_dir3_leaf_log_bests(struct xfs_trans *tp, struct xfs_buf *bp, static void xfs_dir3_leaf_log_bests(struct xfs_da_args *args,
int first, int last); struct xfs_buf *bp, int first, int last);
static void xfs_dir3_leaf_log_tail(struct xfs_trans *tp, struct xfs_buf *bp); static void xfs_dir3_leaf_log_tail(struct xfs_da_args *args,
struct xfs_buf *bp);
/* /*
* Check the internal consistency of a leaf1 block. * Check the internal consistency of a leaf1 block.
...@@ -357,9 +358,9 @@ xfs_dir3_leaf_get_buf( ...@@ -357,9 +358,9 @@ xfs_dir3_leaf_get_buf(
return error; return error;
xfs_dir3_leaf_init(mp, tp, bp, dp->i_ino, magic); xfs_dir3_leaf_init(mp, tp, bp, dp->i_ino, magic);
xfs_dir3_leaf_log_header(tp, dp, bp); xfs_dir3_leaf_log_header(args, bp);
if (magic == XFS_DIR2_LEAF1_MAGIC) if (magic == XFS_DIR2_LEAF1_MAGIC)
xfs_dir3_leaf_log_tail(tp, bp); xfs_dir3_leaf_log_tail(args, bp);
*bpp = bp; *bpp = bp;
return 0; return 0;
} }
...@@ -428,21 +429,21 @@ xfs_dir2_block_to_leaf( ...@@ -428,21 +429,21 @@ xfs_dir2_block_to_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);
xfs_dir3_leaf_log_header(tp, dp, lbp); xfs_dir3_leaf_log_header(args, lbp);
/* /*
* Could compact these but I think we always do the conversion * Could compact these but I think we always do the conversion
* after squeezing out stale entries. * after squeezing out stale entries.
*/ */
memcpy(ents, blp, be32_to_cpu(btp->count) * sizeof(xfs_dir2_leaf_entry_t)); memcpy(ents, blp, be32_to_cpu(btp->count) * sizeof(xfs_dir2_leaf_entry_t));
xfs_dir3_leaf_log_ents(tp, dp, lbp, 0, leafhdr.count - 1); xfs_dir3_leaf_log_ents(args, lbp, 0, leafhdr.count - 1);
needscan = 0; needscan = 0;
needlog = 1; needlog = 1;
/* /*
* Make the space formerly occupied by the leaf entries and block * Make the space formerly occupied by the leaf entries and block
* tail be free. * tail be free.
*/ */
xfs_dir2_data_make_free(tp, dp, dbp, xfs_dir2_data_make_free(args, dbp,
(xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr),
(xfs_dir2_data_aoff_t)((char *)hdr + args->geo->blksize - (xfs_dir2_data_aoff_t)((char *)hdr + args->geo->blksize -
(char *)blp), (char *)blp),
...@@ -470,10 +471,10 @@ xfs_dir2_block_to_leaf( ...@@ -470,10 +471,10 @@ xfs_dir2_block_to_leaf(
* Log the data header and leaf bests table. * Log the data header and leaf bests table.
*/ */
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, dbp); xfs_dir2_data_log_header(args, dbp);
xfs_dir3_leaf_check(dp, lbp); xfs_dir3_leaf_check(dp, lbp);
xfs_dir3_data_check(dp, dbp); xfs_dir3_data_check(dp, dbp);
xfs_dir3_leaf_log_bests(tp, lbp, 0, 0); xfs_dir3_leaf_log_bests(args, lbp, 0, 0);
return 0; return 0;
} }
...@@ -811,14 +812,15 @@ xfs_dir2_leaf_addname( ...@@ -811,14 +812,15 @@ xfs_dir2_leaf_addname(
memmove(&bestsp[0], &bestsp[1], memmove(&bestsp[0], &bestsp[1],
be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0])); be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0]));
be32_add_cpu(&ltp->bestcount, 1); be32_add_cpu(&ltp->bestcount, 1);
xfs_dir3_leaf_log_tail(tp, lbp); xfs_dir3_leaf_log_tail(args, lbp);
xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); xfs_dir3_leaf_log_bests(args, lbp, 0,
be32_to_cpu(ltp->bestcount) - 1);
} }
/* /*
* If we're filling in a previously empty block just log it. * If we're filling in a previously empty block just log it.
*/ */
else else
xfs_dir3_leaf_log_bests(tp, lbp, use_block, use_block); xfs_dir3_leaf_log_bests(args, lbp, use_block, use_block);
hdr = dbp->b_addr; hdr = dbp->b_addr;
bf = dp->d_ops->data_bestfree_p(hdr); bf = dp->d_ops->data_bestfree_p(hdr);
bestsp[use_block] = bf[0].length; bestsp[use_block] = bf[0].length;
...@@ -849,7 +851,7 @@ xfs_dir2_leaf_addname( ...@@ -849,7 +851,7 @@ xfs_dir2_leaf_addname(
/* /*
* Mark the initial part of our freespace in use for the new entry. * Mark the initial part of our freespace in use for the new entry.
*/ */
xfs_dir2_data_use_free(tp, dp, dbp, dup, xfs_dir2_data_use_free(args, dbp, dup,
(xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length,
&needlog, &needscan); &needlog, &needscan);
/* /*
...@@ -871,8 +873,8 @@ xfs_dir2_leaf_addname( ...@@ -871,8 +873,8 @@ xfs_dir2_leaf_addname(
* Need to log the data block's header. * Need to log the data block's header.
*/ */
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, dbp); xfs_dir2_data_log_header(args, dbp);
xfs_dir2_data_log_entry(tp, dp, dbp, dep); xfs_dir2_data_log_entry(args, dbp, dep);
/* /*
* If the bests table needs to be changed, do it. * If the bests table needs to be changed, do it.
* Log the change unless we've already done that. * Log the change unless we've already done that.
...@@ -880,7 +882,7 @@ xfs_dir2_leaf_addname( ...@@ -880,7 +882,7 @@ xfs_dir2_leaf_addname(
if (be16_to_cpu(bestsp[use_block]) != be16_to_cpu(bf[0].length)) { if (be16_to_cpu(bestsp[use_block]) != be16_to_cpu(bf[0].length)) {
bestsp[use_block] = bf[0].length; bestsp[use_block] = bf[0].length;
if (!grown) if (!grown)
xfs_dir3_leaf_log_bests(tp, lbp, use_block, use_block); xfs_dir3_leaf_log_bests(args, lbp, use_block, use_block);
} }
lep = xfs_dir3_leaf_find_entry(&leafhdr, ents, index, compact, lowstale, lep = xfs_dir3_leaf_find_entry(&leafhdr, ents, index, compact, lowstale,
...@@ -897,8 +899,8 @@ xfs_dir2_leaf_addname( ...@@ -897,8 +899,8 @@ xfs_dir2_leaf_addname(
* Log the leaf fields and give up the buffers. * Log the leaf fields and give up the buffers.
*/ */
dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
xfs_dir3_leaf_log_header(tp, dp, lbp); xfs_dir3_leaf_log_header(args, lbp);
xfs_dir3_leaf_log_ents(tp, dp, lbp, lfloglow, lfloghigh); xfs_dir3_leaf_log_ents(args, lbp, lfloglow, lfloghigh);
xfs_dir3_leaf_check(dp, lbp); xfs_dir3_leaf_check(dp, lbp);
xfs_dir3_data_check(dp, dbp); xfs_dir3_data_check(dp, dbp);
return 0; return 0;
...@@ -950,9 +952,9 @@ xfs_dir3_leaf_compact( ...@@ -950,9 +952,9 @@ xfs_dir3_leaf_compact(
leafhdr->stale = 0; leafhdr->stale = 0;
dp->d_ops->leaf_hdr_to_disk(leaf, leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, leafhdr);
xfs_dir3_leaf_log_header(args->trans, dp, bp); xfs_dir3_leaf_log_header(args, bp);
if (loglow != -1) if (loglow != -1)
xfs_dir3_leaf_log_ents(args->trans, dp, bp, loglow, to - 1); xfs_dir3_leaf_log_ents(args, bp, loglow, to - 1);
} }
/* /*
...@@ -1054,7 +1056,7 @@ xfs_dir3_leaf_compact_x1( ...@@ -1054,7 +1056,7 @@ xfs_dir3_leaf_compact_x1(
*/ */
static void static void
xfs_dir3_leaf_log_bests( xfs_dir3_leaf_log_bests(
xfs_trans_t *tp, /* transaction pointer */ struct xfs_da_args *args,
struct xfs_buf *bp, /* leaf buffer */ struct xfs_buf *bp, /* leaf buffer */
int first, /* first entry to log */ int first, /* first entry to log */
int last) /* last entry to log */ int last) /* last entry to log */
...@@ -1067,10 +1069,11 @@ xfs_dir3_leaf_log_bests( ...@@ -1067,10 +1069,11 @@ xfs_dir3_leaf_log_bests(
ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC)); leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC));
ltp = xfs_dir2_leaf_tail_p(tp->t_mountp->m_dir_geo, leaf); ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
firstb = xfs_dir2_leaf_bests_p(ltp) + first; firstb = xfs_dir2_leaf_bests_p(ltp) + first;
lastb = xfs_dir2_leaf_bests_p(ltp) + last; lastb = xfs_dir2_leaf_bests_p(ltp) + last;
xfs_trans_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf), xfs_trans_log_buf(args->trans, bp,
(uint)((char *)firstb - (char *)leaf),
(uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1)); (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1));
} }
...@@ -1079,8 +1082,7 @@ xfs_dir3_leaf_log_bests( ...@@ -1079,8 +1082,7 @@ xfs_dir3_leaf_log_bests(
*/ */
void void
xfs_dir3_leaf_log_ents( xfs_dir3_leaf_log_ents(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp, struct xfs_buf *bp,
int first, int first,
int last) int last)
...@@ -1095,10 +1097,11 @@ xfs_dir3_leaf_log_ents( ...@@ -1095,10 +1097,11 @@ xfs_dir3_leaf_log_ents(
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
ents = dp->d_ops->leaf_ents_p(leaf); ents = args->dp->d_ops->leaf_ents_p(leaf);
firstlep = &ents[first]; firstlep = &ents[first];
lastlep = &ents[last]; lastlep = &ents[last];
xfs_trans_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf), xfs_trans_log_buf(args->trans, bp,
(uint)((char *)firstlep - (char *)leaf),
(uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1)); (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1));
} }
...@@ -1107,8 +1110,7 @@ xfs_dir3_leaf_log_ents( ...@@ -1107,8 +1110,7 @@ xfs_dir3_leaf_log_ents(
*/ */
void void
xfs_dir3_leaf_log_header( xfs_dir3_leaf_log_header(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_dir2_leaf *leaf = bp->b_addr; struct xfs_dir2_leaf *leaf = bp->b_addr;
...@@ -1118,8 +1120,9 @@ xfs_dir3_leaf_log_header( ...@@ -1118,8 +1120,9 @@ xfs_dir3_leaf_log_header(
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), xfs_trans_log_buf(args->trans, bp,
dp->d_ops->leaf_hdr_size - 1); (uint)((char *)&leaf->hdr - (char *)leaf),
args->dp->d_ops->leaf_hdr_size - 1);
} }
/* /*
...@@ -1127,21 +1130,20 @@ xfs_dir3_leaf_log_header( ...@@ -1127,21 +1130,20 @@ xfs_dir3_leaf_log_header(
*/ */
STATIC void STATIC void
xfs_dir3_leaf_log_tail( xfs_dir3_leaf_log_tail(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
struct xfs_dir2_leaf *leaf = bp->b_addr; struct xfs_dir2_leaf *leaf = bp->b_addr;
xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
struct xfs_mount *mp = tp->t_mountp;
ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) || leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) ||
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf); ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
xfs_trans_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf), xfs_trans_log_buf(args->trans, bp, (uint)((char *)ltp - (char *)leaf),
(uint)(mp->m_dir_geo->blksize - 1)); (uint)(args->geo->blksize - 1));
} }
/* /*
...@@ -1395,7 +1397,7 @@ xfs_dir2_leaf_removename( ...@@ -1395,7 +1397,7 @@ xfs_dir2_leaf_removename(
/* /*
* Mark the former data entry unused. * Mark the former data entry unused.
*/ */
xfs_dir2_data_make_free(tp, dp, dbp, xfs_dir2_data_make_free(args, dbp,
(xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
/* /*
...@@ -1403,10 +1405,10 @@ xfs_dir2_leaf_removename( ...@@ -1403,10 +1405,10 @@ xfs_dir2_leaf_removename(
*/ */
leafhdr.stale++; leafhdr.stale++;
dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
xfs_dir3_leaf_log_header(tp, dp, lbp); xfs_dir3_leaf_log_header(args, lbp);
lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
xfs_dir3_leaf_log_ents(tp, dp, lbp, index, index); xfs_dir3_leaf_log_ents(args, lbp, index, index);
/* /*
* Scan the freespace in the data block again if necessary, * Scan the freespace in the data block again if necessary,
...@@ -1415,14 +1417,14 @@ xfs_dir2_leaf_removename( ...@@ -1415,14 +1417,14 @@ xfs_dir2_leaf_removename(
if (needscan) if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog); xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, dbp); xfs_dir2_data_log_header(args, dbp);
/* /*
* If the longest freespace in the data block has changed, * If the longest freespace in the data block has changed,
* put the new value in the bests table and log that. * put the new value in the bests table and log that.
*/ */
if (be16_to_cpu(bf[0].length) != oldbest) { if (be16_to_cpu(bf[0].length) != oldbest) {
bestsp[db] = bf[0].length; bestsp[db] = bf[0].length;
xfs_dir3_leaf_log_bests(tp, lbp, db, db); xfs_dir3_leaf_log_bests(args, lbp, db, db);
} }
xfs_dir3_data_check(dp, dbp); xfs_dir3_data_check(dp, dbp);
/* /*
...@@ -1463,8 +1465,9 @@ xfs_dir2_leaf_removename( ...@@ -1463,8 +1465,9 @@ xfs_dir2_leaf_removename(
memmove(&bestsp[db - i], bestsp, memmove(&bestsp[db - i], bestsp,
(be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp)); (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp));
be32_add_cpu(&ltp->bestcount, -(db - i)); be32_add_cpu(&ltp->bestcount, -(db - i));
xfs_dir3_leaf_log_tail(tp, lbp); xfs_dir3_leaf_log_tail(args, lbp);
xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); xfs_dir3_leaf_log_bests(args, lbp, 0,
be32_to_cpu(ltp->bestcount) - 1);
} else } else
bestsp[db] = cpu_to_be16(NULLDATAOFF); bestsp[db] = cpu_to_be16(NULLDATAOFF);
} }
...@@ -1527,7 +1530,7 @@ xfs_dir2_leaf_replace( ...@@ -1527,7 +1530,7 @@ xfs_dir2_leaf_replace(
dep->inumber = cpu_to_be64(args->inumber); dep->inumber = cpu_to_be64(args->inumber);
dp->d_ops->data_put_ftype(dep, args->filetype); dp->d_ops->data_put_ftype(dep, args->filetype);
tp = args->trans; tp = args->trans;
xfs_dir2_data_log_entry(tp, dp, dbp, dep); xfs_dir2_data_log_entry(args, dbp, dep);
xfs_dir3_leaf_check(dp, lbp); xfs_dir3_leaf_check(dp, lbp);
xfs_trans_brelse(tp, lbp); xfs_trans_brelse(tp, lbp);
return 0; return 0;
...@@ -1648,8 +1651,8 @@ xfs_dir2_leaf_trim_data( ...@@ -1648,8 +1651,8 @@ xfs_dir2_leaf_trim_data(
bestsp = xfs_dir2_leaf_bests_p(ltp); bestsp = xfs_dir2_leaf_bests_p(ltp);
be32_add_cpu(&ltp->bestcount, -1); be32_add_cpu(&ltp->bestcount, -1);
memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp)); memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp));
xfs_dir3_leaf_log_tail(tp, lbp); xfs_dir3_leaf_log_tail(args, lbp);
xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); xfs_dir3_leaf_log_bests(args, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
return 0; return 0;
} }
...@@ -1795,9 +1798,9 @@ xfs_dir2_node_to_leaf( ...@@ -1795,9 +1798,9 @@ xfs_dir2_node_to_leaf(
freehdr.nvalid * sizeof(xfs_dir2_data_off_t)); freehdr.nvalid * sizeof(xfs_dir2_data_off_t));
dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
xfs_dir3_leaf_log_header(tp, dp, lbp); xfs_dir3_leaf_log_header(args, lbp);
xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); xfs_dir3_leaf_log_bests(args, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
xfs_dir3_leaf_log_tail(tp, lbp); xfs_dir3_leaf_log_tail(args, lbp);
xfs_dir3_leaf_check(dp, lbp); xfs_dir3_leaf_check(dp, lbp);
/* /*
......
...@@ -241,8 +241,7 @@ xfs_dir3_free_get_buf( ...@@ -241,8 +241,7 @@ xfs_dir3_free_get_buf(
*/ */
STATIC void STATIC void
xfs_dir2_free_log_bests( xfs_dir2_free_log_bests(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp, struct xfs_buf *bp,
int first, /* first entry to log */ int first, /* first entry to log */
int last) /* last entry to log */ int last) /* last entry to log */
...@@ -251,10 +250,10 @@ xfs_dir2_free_log_bests( ...@@ -251,10 +250,10 @@ xfs_dir2_free_log_bests(
__be16 *bests; __be16 *bests;
free = bp->b_addr; free = bp->b_addr;
bests = dp->d_ops->free_bests_p(free); bests = args->dp->d_ops->free_bests_p(free);
ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
xfs_trans_log_buf(tp, bp, xfs_trans_log_buf(args->trans, bp,
(uint)((char *)&bests[first] - (char *)free), (uint)((char *)&bests[first] - (char *)free),
(uint)((char *)&bests[last] - (char *)free + (uint)((char *)&bests[last] - (char *)free +
sizeof(bests[0]) - 1)); sizeof(bests[0]) - 1));
...@@ -265,8 +264,7 @@ xfs_dir2_free_log_bests( ...@@ -265,8 +264,7 @@ xfs_dir2_free_log_bests(
*/ */
static void static void
xfs_dir2_free_log_header( xfs_dir2_free_log_header(
struct xfs_trans *tp, struct xfs_da_args *args,
struct xfs_inode *dp,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -276,7 +274,8 @@ xfs_dir2_free_log_header( ...@@ -276,7 +274,8 @@ xfs_dir2_free_log_header(
ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
#endif #endif
xfs_trans_log_buf(tp, bp, 0, dp->d_ops->free_hdr_size - 1); xfs_trans_log_buf(args->trans, bp, 0,
args->dp->d_ops->free_hdr_size - 1);
} }
/* /*
...@@ -350,8 +349,8 @@ xfs_dir2_leaf_to_node( ...@@ -350,8 +349,8 @@ xfs_dir2_leaf_to_node(
freehdr.nvalid = be32_to_cpu(ltp->bestcount); freehdr.nvalid = be32_to_cpu(ltp->bestcount);
dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr); dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr);
xfs_dir2_free_log_bests(tp, dp, fbp, 0, freehdr.nvalid - 1); xfs_dir2_free_log_bests(args, fbp, 0, freehdr.nvalid - 1);
xfs_dir2_free_log_header(tp, dp, fbp); xfs_dir2_free_log_header(args, fbp);
/* /*
* Converting the leaf to a leafnode is just a matter of changing the * Converting the leaf to a leafnode is just a matter of changing the
...@@ -365,7 +364,7 @@ xfs_dir2_leaf_to_node( ...@@ -365,7 +364,7 @@ xfs_dir2_leaf_to_node(
leaf->hdr.info.magic = cpu_to_be16(XFS_DIR3_LEAFN_MAGIC); leaf->hdr.info.magic = cpu_to_be16(XFS_DIR3_LEAFN_MAGIC);
lbp->b_ops = &xfs_dir3_leafn_buf_ops; lbp->b_ops = &xfs_dir3_leafn_buf_ops;
xfs_trans_buf_set_type(tp, lbp, XFS_BLFT_DIR_LEAFN_BUF); xfs_trans_buf_set_type(tp, lbp, XFS_BLFT_DIR_LEAFN_BUF);
xfs_dir3_leaf_log_header(tp, dp, lbp); xfs_dir3_leaf_log_header(args, lbp);
xfs_dir3_leaf_check(dp, lbp); xfs_dir3_leaf_check(dp, lbp);
return 0; return 0;
} }
...@@ -455,8 +454,8 @@ xfs_dir2_leafn_add( ...@@ -455,8 +454,8 @@ xfs_dir2_leafn_add(
args->blkno, args->index)); args->blkno, args->index));
dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
xfs_dir3_leaf_log_header(tp, dp, bp); xfs_dir3_leaf_log_header(args, bp);
xfs_dir3_leaf_log_ents(tp, dp, bp, lfloglow, lfloghigh); xfs_dir3_leaf_log_ents(args, bp, lfloglow, lfloghigh);
xfs_dir3_leaf_check(dp, bp); xfs_dir3_leaf_check(dp, bp);
return 0; return 0;
} }
...@@ -851,7 +850,6 @@ xfs_dir3_leafn_moveents( ...@@ -851,7 +850,6 @@ xfs_dir3_leafn_moveents(
int start_d,/* destination leaf index */ int start_d,/* destination leaf index */
int count) /* count of leaves to copy */ int count) /* count of leaves to copy */
{ {
struct xfs_trans *tp = args->trans;
int stale; /* count stale leaves copied */ int stale; /* count stale leaves copied */
trace_xfs_dir2_leafn_moveents(args, start_s, start_d, count); trace_xfs_dir2_leafn_moveents(args, start_s, start_d, count);
...@@ -870,7 +868,7 @@ xfs_dir3_leafn_moveents( ...@@ -870,7 +868,7 @@ xfs_dir3_leafn_moveents(
if (start_d < dhdr->count) { if (start_d < dhdr->count) {
memmove(&dents[start_d + count], &dents[start_d], memmove(&dents[start_d + count], &dents[start_d],
(dhdr->count - start_d) * sizeof(xfs_dir2_leaf_entry_t)); (dhdr->count - start_d) * sizeof(xfs_dir2_leaf_entry_t));
xfs_dir3_leaf_log_ents(tp, args->dp, bp_d, start_d + count, xfs_dir3_leaf_log_ents(args, bp_d, start_d + count,
count + dhdr->count - 1); count + dhdr->count - 1);
} }
/* /*
...@@ -892,8 +890,7 @@ xfs_dir3_leafn_moveents( ...@@ -892,8 +890,7 @@ xfs_dir3_leafn_moveents(
*/ */
memcpy(&dents[start_d], &sents[start_s], memcpy(&dents[start_d], &sents[start_s],
count * sizeof(xfs_dir2_leaf_entry_t)); count * sizeof(xfs_dir2_leaf_entry_t));
xfs_dir3_leaf_log_ents(tp, args->dp, bp_d, xfs_dir3_leaf_log_ents(args, bp_d, start_d, start_d + count - 1);
start_d, start_d + count - 1);
/* /*
* If there are source entries after the ones we copied, * If there are source entries after the ones we copied,
...@@ -902,8 +899,7 @@ xfs_dir3_leafn_moveents( ...@@ -902,8 +899,7 @@ xfs_dir3_leafn_moveents(
if (start_s + count < shdr->count) { if (start_s + count < shdr->count) {
memmove(&sents[start_s], &sents[start_s + count], memmove(&sents[start_s], &sents[start_s + count],
count * sizeof(xfs_dir2_leaf_entry_t)); count * sizeof(xfs_dir2_leaf_entry_t));
xfs_dir3_leaf_log_ents(tp, args->dp, bp_s, xfs_dir3_leaf_log_ents(args, bp_s, start_s, start_s + count - 1);
start_s, start_s + count - 1);
} }
/* /*
...@@ -1039,8 +1035,8 @@ xfs_dir2_leafn_rebalance( ...@@ -1039,8 +1035,8 @@ xfs_dir2_leafn_rebalance(
/* log the changes made when moving the entries */ /* log the changes made when moving the entries */
dp->d_ops->leaf_hdr_to_disk(leaf1, &hdr1); dp->d_ops->leaf_hdr_to_disk(leaf1, &hdr1);
dp->d_ops->leaf_hdr_to_disk(leaf2, &hdr2); dp->d_ops->leaf_hdr_to_disk(leaf2, &hdr2);
xfs_dir3_leaf_log_header(args->trans, dp, blk1->bp); xfs_dir3_leaf_log_header(args, blk1->bp);
xfs_dir3_leaf_log_header(args->trans, dp, blk2->bp); xfs_dir3_leaf_log_header(args, blk2->bp);
xfs_dir3_leaf_check(dp, blk1->bp); xfs_dir3_leaf_check(dp, blk1->bp);
xfs_dir3_leaf_check(dp, blk2->bp); xfs_dir3_leaf_check(dp, blk2->bp);
...@@ -1083,7 +1079,6 @@ xfs_dir3_data_block_free( ...@@ -1083,7 +1079,6 @@ xfs_dir3_data_block_free(
struct xfs_buf *fbp, struct xfs_buf *fbp,
int longest) int longest)
{ {
struct xfs_trans *tp = args->trans;
int logfree = 0; int logfree = 0;
__be16 *bests; __be16 *bests;
struct xfs_dir3_icfree_hdr freehdr; struct xfs_dir3_icfree_hdr freehdr;
...@@ -1097,7 +1092,7 @@ xfs_dir3_data_block_free( ...@@ -1097,7 +1092,7 @@ xfs_dir3_data_block_free(
* value. * value.
*/ */
bests[findex] = cpu_to_be16(longest); bests[findex] = cpu_to_be16(longest);
xfs_dir2_free_log_bests(tp, dp, fbp, findex, findex); xfs_dir2_free_log_bests(args, fbp, findex, findex);
return 0; return 0;
} }
...@@ -1125,7 +1120,7 @@ xfs_dir3_data_block_free( ...@@ -1125,7 +1120,7 @@ xfs_dir3_data_block_free(
} }
dp->d_ops->free_hdr_to_disk(free, &freehdr); dp->d_ops->free_hdr_to_disk(free, &freehdr);
xfs_dir2_free_log_header(tp, dp, fbp); xfs_dir2_free_log_header(args, fbp);
/* /*
* If there are no useful entries left in the block, get rid of the * If there are no useful entries left in the block, get rid of the
...@@ -1149,7 +1144,7 @@ xfs_dir3_data_block_free( ...@@ -1149,7 +1144,7 @@ xfs_dir3_data_block_free(
/* Log the free entry that changed, unless we got rid of it. */ /* Log the free entry that changed, unless we got rid of it. */
if (logfree) if (logfree)
xfs_dir2_free_log_bests(tp, dp, fbp, findex, findex); xfs_dir2_free_log_bests(args, fbp, findex, findex);
return 0; return 0;
} }
...@@ -1211,10 +1206,10 @@ xfs_dir2_leafn_remove( ...@@ -1211,10 +1206,10 @@ xfs_dir2_leafn_remove(
*/ */
leafhdr.stale++; leafhdr.stale++;
dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
xfs_dir3_leaf_log_header(tp, dp, bp); xfs_dir3_leaf_log_header(args, bp);
lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
xfs_dir3_leaf_log_ents(tp, dp, bp, index, index); xfs_dir3_leaf_log_ents(args, bp, index, index);
/* /*
* Make the data entry free. Keep track of the longest freespace * Make the data entry free. Keep track of the longest freespace
...@@ -1226,7 +1221,7 @@ xfs_dir2_leafn_remove( ...@@ -1226,7 +1221,7 @@ xfs_dir2_leafn_remove(
bf = dp->d_ops->data_bestfree_p(hdr); bf = dp->d_ops->data_bestfree_p(hdr);
longest = be16_to_cpu(bf[0].length); longest = be16_to_cpu(bf[0].length);
needlog = needscan = 0; needlog = needscan = 0;
xfs_dir2_data_make_free(tp, dp, dbp, off, xfs_dir2_data_make_free(args, dbp, off,
dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
/* /*
* Rescan the data block freespaces for bestfree. * Rescan the data block freespaces for bestfree.
...@@ -1235,7 +1230,7 @@ xfs_dir2_leafn_remove( ...@@ -1235,7 +1230,7 @@ xfs_dir2_leafn_remove(
if (needscan) if (needscan)
xfs_dir2_data_freescan(dp, hdr, &needlog); xfs_dir2_data_freescan(dp, hdr, &needlog);
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, dbp); xfs_dir2_data_log_header(args, dbp);
xfs_dir3_data_check(dp, dbp); xfs_dir3_data_check(dp, dbp);
/* /*
* If the longest data block freespace changes, need to update * If the longest data block freespace changes, need to update
...@@ -1569,8 +1564,8 @@ xfs_dir2_leafn_unbalance( ...@@ -1569,8 +1564,8 @@ xfs_dir2_leafn_unbalance(
/* log the changes made when moving the entries */ /* log the changes made when moving the entries */
dp->d_ops->leaf_hdr_to_disk(save_leaf, &savehdr); dp->d_ops->leaf_hdr_to_disk(save_leaf, &savehdr);
dp->d_ops->leaf_hdr_to_disk(drop_leaf, &drophdr); dp->d_ops->leaf_hdr_to_disk(drop_leaf, &drophdr);
xfs_dir3_leaf_log_header(args->trans, dp, save_blk->bp); xfs_dir3_leaf_log_header(args, save_blk->bp);
xfs_dir3_leaf_log_header(args->trans, dp, drop_blk->bp); xfs_dir3_leaf_log_header(args, drop_blk->bp);
xfs_dir3_leaf_check(dp, save_blk->bp); xfs_dir3_leaf_check(dp, save_blk->bp);
xfs_dir3_leaf_check(dp, drop_blk->bp); xfs_dir3_leaf_check(dp, drop_blk->bp);
...@@ -1931,7 +1926,7 @@ xfs_dir2_node_addname_int( ...@@ -1931,7 +1926,7 @@ xfs_dir2_node_addname_int(
if (bests[findex] == cpu_to_be16(NULLDATAOFF)) { if (bests[findex] == cpu_to_be16(NULLDATAOFF)) {
freehdr.nused++; freehdr.nused++;
dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr); dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr);
xfs_dir2_free_log_header(tp, dp, fbp); xfs_dir2_free_log_header(args, fbp);
} }
/* /*
* Update the real value in the table. * Update the real value in the table.
...@@ -1975,7 +1970,7 @@ xfs_dir2_node_addname_int( ...@@ -1975,7 +1970,7 @@ xfs_dir2_node_addname_int(
/* /*
* Mark the first part of the unused space, inuse for us. * Mark the first part of the unused space, inuse for us.
*/ */
xfs_dir2_data_use_free(tp, dp, dbp, dup, xfs_dir2_data_use_free(args, dbp, dup,
(xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length,
&needlog, &needscan); &needlog, &needscan);
/* /*
...@@ -1988,7 +1983,7 @@ xfs_dir2_node_addname_int( ...@@ -1988,7 +1983,7 @@ xfs_dir2_node_addname_int(
dp->d_ops->data_put_ftype(dep, args->filetype); dp->d_ops->data_put_ftype(dep, args->filetype);
tagp = dp->d_ops->data_entry_tag_p(dep); tagp = dp->d_ops->data_entry_tag_p(dep);
*tagp = cpu_to_be16((char *)dep - (char *)hdr); *tagp = cpu_to_be16((char *)dep - (char *)hdr);
xfs_dir2_data_log_entry(tp, dp, dbp, dep); xfs_dir2_data_log_entry(args, dbp, dep);
/* /*
* Rescan the block for bestfree if needed. * Rescan the block for bestfree if needed.
*/ */
...@@ -1998,7 +1993,7 @@ xfs_dir2_node_addname_int( ...@@ -1998,7 +1993,7 @@ xfs_dir2_node_addname_int(
* Log the data block header if needed. * Log the data block header if needed.
*/ */
if (needlog) if (needlog)
xfs_dir2_data_log_header(tp, dp, dbp); xfs_dir2_data_log_header(args, dbp);
/* /*
* If the freespace entry is now wrong, update it. * If the freespace entry is now wrong, update it.
*/ */
...@@ -2011,7 +2006,7 @@ xfs_dir2_node_addname_int( ...@@ -2011,7 +2006,7 @@ xfs_dir2_node_addname_int(
* Log the freespace entry if needed. * Log the freespace entry if needed.
*/ */
if (logfree) if (logfree)
xfs_dir2_free_log_bests(tp, dp, fbp, findex, findex); xfs_dir2_free_log_bests(args, fbp, findex, findex);
/* /*
* Return the data block and offset in args, then drop the data block. * Return the data block and offset in args, then drop the data block.
*/ */
...@@ -2208,8 +2203,7 @@ xfs_dir2_node_replace( ...@@ -2208,8 +2203,7 @@ xfs_dir2_node_replace(
*/ */
dep->inumber = cpu_to_be64(inum); dep->inumber = cpu_to_be64(inum);
args->dp->d_ops->data_put_ftype(dep, args->filetype); args->dp->d_ops->data_put_ftype(dep, args->filetype);
xfs_dir2_data_log_entry(args->trans, args->dp, xfs_dir2_data_log_entry(args, state->extrablk.bp, dep);
state->extrablk.bp, dep);
rval = 0; rval = 0;
} }
/* /*
......
...@@ -211,9 +211,9 @@ extern void xfs_dir3_leaf_compact_x1(struct xfs_dir3_icleaf_hdr *leafhdr, ...@@ -211,9 +211,9 @@ extern void xfs_dir3_leaf_compact_x1(struct xfs_dir3_icleaf_hdr *leafhdr,
int *lowstalep, int *highstalep, int *lowlogp, int *highlogp); int *lowstalep, int *highstalep, int *lowlogp, int *highlogp);
extern int xfs_dir3_leaf_get_buf(struct xfs_da_args *args, xfs_dir2_db_t bno, extern int xfs_dir3_leaf_get_buf(struct xfs_da_args *args, xfs_dir2_db_t bno,
struct xfs_buf **bpp, __uint16_t magic); struct xfs_buf **bpp, __uint16_t magic);
extern void xfs_dir3_leaf_log_ents(struct xfs_trans *tp, struct xfs_inode *dp, extern void xfs_dir3_leaf_log_ents(struct xfs_da_args *args,
struct xfs_buf *bp, int first, int last); struct xfs_buf *bp, int first, int last);
extern void xfs_dir3_leaf_log_header(struct xfs_trans *tp, struct xfs_inode *dp, extern void xfs_dir3_leaf_log_header(struct xfs_da_args *args,
struct xfs_buf *bp); struct xfs_buf *bp);
extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args); extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args);
extern int xfs_dir2_leaf_removename(struct xfs_da_args *args); extern int xfs_dir2_leaf_removename(struct xfs_da_args *args);
......
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