aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-06-06 01:20:54 -0400
committerDave Chinner <david@fromorbit.com>2014-06-06 01:20:54 -0400
commitbc85178a7668db835666c6a5bd53436eebfc94b1 (patch)
treea66a6163b3d24a5cb2d31c33593abddf5563f27f /fs
parent53f82db003900822ff828b792b1690a53a57c028 (diff)
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: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_dir2.h12
-rw-r--r--fs/xfs/xfs_dir2_block.c39
-rw-r--r--fs/xfs/xfs_dir2_data.c59
-rw-r--r--fs/xfs/xfs_dir2_leaf.c103
-rw-r--r--fs/xfs/xfs_dir2_node.c68
-rw-r--r--fs/xfs/xfs_dir2_priv.h4
6 files changed, 137 insertions, 148 deletions
diff --git a/fs/xfs/xfs_dir2.h b/fs/xfs/xfs_dir2.h
index 1292e780e5b7..c8e86b0b5e99 100644
--- a/fs/xfs/xfs_dir2.h
+++ b/fs/xfs/xfs_dir2.h
@@ -153,16 +153,16 @@ extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
153 153
154extern void xfs_dir2_data_freescan(struct xfs_inode *dp, 154extern void xfs_dir2_data_freescan(struct xfs_inode *dp,
155 struct xfs_dir2_data_hdr *hdr, int *loghead); 155 struct xfs_dir2_data_hdr *hdr, int *loghead);
156extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_inode *dp, 156extern void xfs_dir2_data_log_entry(struct xfs_da_args *args,
157 struct xfs_buf *bp, struct xfs_dir2_data_entry *dep); 157 struct xfs_buf *bp, struct xfs_dir2_data_entry *dep);
158extern void xfs_dir2_data_log_header(struct xfs_trans *tp, struct xfs_inode *dp, 158extern void xfs_dir2_data_log_header(struct xfs_da_args *args,
159 struct xfs_buf *bp); 159 struct xfs_buf *bp);
160extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp, 160extern void xfs_dir2_data_log_unused(struct xfs_da_args *args,
161 struct xfs_dir2_data_unused *dup); 161 struct xfs_buf *bp, struct xfs_dir2_data_unused *dup);
162extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_inode *dp, 162extern void xfs_dir2_data_make_free(struct xfs_da_args *args,
163 struct xfs_buf *bp, xfs_dir2_data_aoff_t offset, 163 struct xfs_buf *bp, xfs_dir2_data_aoff_t offset,
164 xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp); 164 xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
165extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_inode *dp, 165extern void xfs_dir2_data_use_free(struct xfs_da_args *args,
166 struct xfs_buf *bp, struct xfs_dir2_data_unused *dup, 166 struct xfs_buf *bp, struct xfs_dir2_data_unused *dup,
167 xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len, 167 xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
168 int *needlogp, int *needscanp); 168 int *needlogp, int *needscanp);
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 4204df966980..c7cd3154026a 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -281,8 +281,7 @@ out:
281 */ 281 */
282static void 282static void
283xfs_dir2_block_compact( 283xfs_dir2_block_compact(
284 struct xfs_trans *tp, 284 struct xfs_da_args *args,
285 struct xfs_inode *dp,
286 struct xfs_buf *bp, 285 struct xfs_buf *bp,
287 struct xfs_dir2_data_hdr *hdr, 286 struct xfs_dir2_data_hdr *hdr,
288 struct xfs_dir2_block_tail *btp, 287 struct xfs_dir2_block_tail *btp,
@@ -315,7 +314,7 @@ xfs_dir2_block_compact(
315 *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1); 314 *lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1);
316 *lfloghigh -= be32_to_cpu(btp->stale) - 1; 315 *lfloghigh -= be32_to_cpu(btp->stale) - 1;
317 be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1)); 316 be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1));
318 xfs_dir2_data_make_free(tp, dp, bp, 317 xfs_dir2_data_make_free(args, bp,
319 (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), 318 (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr),
320 (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)), 319 (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)),
321 needlog, &needscan); 320 needlog, &needscan);
@@ -325,7 +324,7 @@ xfs_dir2_block_compact(
325 * This needs to happen before the next call to use_free. 324 * This needs to happen before the next call to use_free.
326 */ 325 */
327 if (needscan) 326 if (needscan)
328 xfs_dir2_data_freescan(dp, hdr, needlog); 327 xfs_dir2_data_freescan(args->dp, hdr, needlog);
329} 328}
330 329
331/* 330/*
@@ -420,7 +419,7 @@ xfs_dir2_block_addname(
420 * If need to compact the leaf entries, do it now. 419 * If need to compact the leaf entries, do it now.
421 */ 420 */
422 if (compact) { 421 if (compact) {
423 xfs_dir2_block_compact(tp, dp, bp, hdr, btp, blp, &needlog, 422 xfs_dir2_block_compact(args, bp, hdr, btp, blp, &needlog,
424 &lfloghigh, &lfloglow); 423 &lfloghigh, &lfloglow);
425 /* recalculate blp post-compaction */ 424 /* recalculate blp post-compaction */
426 blp = xfs_dir2_block_leaf_p(btp); 425 blp = xfs_dir2_block_leaf_p(btp);
@@ -455,7 +454,7 @@ xfs_dir2_block_addname(
455 /* 454 /*
456 * Mark the space needed for the new leaf entry, now in use. 455 * Mark the space needed for the new leaf entry, now in use.
457 */ 456 */
458 xfs_dir2_data_use_free(tp, dp, bp, enddup, 457 xfs_dir2_data_use_free(args, bp, enddup,
459 (xfs_dir2_data_aoff_t) 458 (xfs_dir2_data_aoff_t)
460 ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) - 459 ((char *)enddup - (char *)hdr + be16_to_cpu(enddup->length) -
461 sizeof(*blp)), 460 sizeof(*blp)),
@@ -542,7 +541,7 @@ xfs_dir2_block_addname(
542 /* 541 /*
543 * Mark space for the data entry used. 542 * Mark space for the data entry used.
544 */ 543 */
545 xfs_dir2_data_use_free(tp, dp, bp, dup, 544 xfs_dir2_data_use_free(args, bp, dup,
546 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), 545 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr),
547 (xfs_dir2_data_aoff_t)len, &needlog, &needscan); 546 (xfs_dir2_data_aoff_t)len, &needlog, &needscan);
548 /* 547 /*
@@ -560,9 +559,9 @@ xfs_dir2_block_addname(
560 if (needscan) 559 if (needscan)
561 xfs_dir2_data_freescan(dp, hdr, &needlog); 560 xfs_dir2_data_freescan(dp, hdr, &needlog);
562 if (needlog) 561 if (needlog)
563 xfs_dir2_data_log_header(tp, dp, bp); 562 xfs_dir2_data_log_header(args, bp);
564 xfs_dir2_block_log_tail(tp, bp); 563 xfs_dir2_block_log_tail(tp, bp);
565 xfs_dir2_data_log_entry(tp, dp, bp, dep); 564 xfs_dir2_data_log_entry(args, bp, dep);
566 xfs_dir3_data_check(dp, bp); 565 xfs_dir3_data_check(dp, bp);
567 return 0; 566 return 0;
568} 567}
@@ -803,7 +802,7 @@ xfs_dir2_block_removename(
803 * Mark the data entry's space free. 802 * Mark the data entry's space free.
804 */ 803 */
805 needlog = needscan = 0; 804 needlog = needscan = 0;
806 xfs_dir2_data_make_free(tp, dp, bp, 805 xfs_dir2_data_make_free(args, bp,
807 (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), 806 (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
808 dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); 807 dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
809 /* 808 /*
@@ -822,7 +821,7 @@ xfs_dir2_block_removename(
822 if (needscan) 821 if (needscan)
823 xfs_dir2_data_freescan(dp, hdr, &needlog); 822 xfs_dir2_data_freescan(dp, hdr, &needlog);
824 if (needlog) 823 if (needlog)
825 xfs_dir2_data_log_header(tp, dp, bp); 824 xfs_dir2_data_log_header(args, bp);
826 xfs_dir3_data_check(dp, bp); 825 xfs_dir3_data_check(dp, bp);
827 /* 826 /*
828 * See if the size as a shortform is good enough. 827 * See if the size as a shortform is good enough.
@@ -881,7 +880,7 @@ xfs_dir2_block_replace(
881 */ 880 */
882 dep->inumber = cpu_to_be64(args->inumber); 881 dep->inumber = cpu_to_be64(args->inumber);
883 dp->d_ops->data_put_ftype(dep, args->filetype); 882 dp->d_ops->data_put_ftype(dep, args->filetype);
884 xfs_dir2_data_log_entry(args->trans, dp, bp, dep); 883 xfs_dir2_data_log_entry(args, bp, dep);
885 xfs_dir3_data_check(dp, bp); 884 xfs_dir3_data_check(dp, bp);
886 return 0; 885 return 0;
887} 886}
@@ -1004,7 +1003,7 @@ xfs_dir2_leaf_to_block(
1004 /* 1003 /*
1005 * Use up the space at the end of the block (blp/btp). 1004 * Use up the space at the end of the block (blp/btp).
1006 */ 1005 */
1007 xfs_dir2_data_use_free(tp, dp, dbp, dup, args->geo->blksize - size, size, 1006 xfs_dir2_data_use_free(args, dbp, dup, args->geo->blksize - size, size,
1008 &needlog, &needscan); 1007 &needlog, &needscan);
1009 /* 1008 /*
1010 * Initialize the block tail. 1009 * Initialize the block tail.
@@ -1030,7 +1029,7 @@ xfs_dir2_leaf_to_block(
1030 if (needscan) 1029 if (needscan)
1031 xfs_dir2_data_freescan(dp, hdr, &needlog); 1030 xfs_dir2_data_freescan(dp, hdr, &needlog);
1032 if (needlog) 1031 if (needlog)
1033 xfs_dir2_data_log_header(tp, dp, dbp); 1032 xfs_dir2_data_log_header(args, dbp);
1034 /* 1033 /*
1035 * Pitch the old leaf block. 1034 * Pitch the old leaf block.
1036 */ 1035 */
@@ -1143,7 +1142,7 @@ xfs_dir2_sf_to_block(
1143 */ 1142 */
1144 dup = dp->d_ops->data_unused_p(hdr); 1143 dup = dp->d_ops->data_unused_p(hdr);
1145 needlog = needscan = 0; 1144 needlog = needscan = 0;
1146 xfs_dir2_data_use_free(tp, dp, bp, dup, args->geo->blksize - i, 1145 xfs_dir2_data_use_free(args, bp, dup, args->geo->blksize - i,
1147 i, &needlog, &needscan); 1146 i, &needlog, &needscan);
1148 ASSERT(needscan == 0); 1147 ASSERT(needscan == 0);
1149 /* 1148 /*
@@ -1157,7 +1156,7 @@ xfs_dir2_sf_to_block(
1157 /* 1156 /*
1158 * Remove the freespace, we'll manage it. 1157 * Remove the freespace, we'll manage it.
1159 */ 1158 */
1160 xfs_dir2_data_use_free(tp, dp, bp, dup, 1159 xfs_dir2_data_use_free(args, bp, dup,
1161 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), 1160 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr),
1162 be16_to_cpu(dup->length), &needlog, &needscan); 1161 be16_to_cpu(dup->length), &needlog, &needscan);
1163 /* 1162 /*
@@ -1170,7 +1169,7 @@ xfs_dir2_sf_to_block(
1170 dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); 1169 dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR);
1171 tagp = dp->d_ops->data_entry_tag_p(dep); 1170 tagp = dp->d_ops->data_entry_tag_p(dep);
1172 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 1171 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
1173 xfs_dir2_data_log_entry(tp, dp, bp, dep); 1172 xfs_dir2_data_log_entry(args, bp, dep);
1174 blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); 1173 blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
1175 blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( 1174 blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
1176 (char *)dep - (char *)hdr)); 1175 (char *)dep - (char *)hdr));
@@ -1184,7 +1183,7 @@ xfs_dir2_sf_to_block(
1184 dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR); 1183 dp->d_ops->data_put_ftype(dep, XFS_DIR3_FT_DIR);
1185 tagp = dp->d_ops->data_entry_tag_p(dep); 1184 tagp = dp->d_ops->data_entry_tag_p(dep);
1186 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 1185 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
1187 xfs_dir2_data_log_entry(tp, dp, bp, dep); 1186 xfs_dir2_data_log_entry(args, bp, dep);
1188 blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); 1187 blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
1189 blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr( 1188 blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(
1190 (char *)dep - (char *)hdr)); 1189 (char *)dep - (char *)hdr));
@@ -1218,7 +1217,7 @@ xfs_dir2_sf_to_block(
1218 dup->length = cpu_to_be16(newoffset - offset); 1217 dup->length = cpu_to_be16(newoffset - offset);
1219 *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16( 1218 *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16(
1220 ((char *)dup - (char *)hdr)); 1219 ((char *)dup - (char *)hdr));
1221 xfs_dir2_data_log_unused(tp, bp, dup); 1220 xfs_dir2_data_log_unused(args, bp, dup);
1222 xfs_dir2_data_freeinsert(hdr, 1221 xfs_dir2_data_freeinsert(hdr,
1223 dp->d_ops->data_bestfree_p(hdr), 1222 dp->d_ops->data_bestfree_p(hdr),
1224 dup, &dummy); 1223 dup, &dummy);
@@ -1235,7 +1234,7 @@ xfs_dir2_sf_to_block(
1235 memcpy(dep->name, sfep->name, dep->namelen); 1234 memcpy(dep->name, sfep->name, dep->namelen);
1236 tagp = dp->d_ops->data_entry_tag_p(dep); 1235 tagp = dp->d_ops->data_entry_tag_p(dep);
1237 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 1236 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
1238 xfs_dir2_data_log_entry(tp, dp, bp, dep); 1237 xfs_dir2_data_log_entry(args, bp, dep);
1239 name.name = sfep->name; 1238 name.name = sfep->name;
1240 name.len = sfep->namelen; 1239 name.len = sfep->namelen;
1241 blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> 1240 blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops->
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index b73d61adf104..8c2f6422648e 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -630,8 +630,8 @@ xfs_dir3_data_init(
630 /* 630 /*
631 * Log it and return it. 631 * Log it and return it.
632 */ 632 */
633 xfs_dir2_data_log_header(tp, dp, bp); 633 xfs_dir2_data_log_header(args, bp);
634 xfs_dir2_data_log_unused(tp, bp, dup); 634 xfs_dir2_data_log_unused(args, bp, dup);
635 *bpp = bp; 635 *bpp = bp;
636 return 0; 636 return 0;
637} 637}
@@ -641,8 +641,7 @@ xfs_dir3_data_init(
641 */ 641 */
642void 642void
643xfs_dir2_data_log_entry( 643xfs_dir2_data_log_entry(
644 struct xfs_trans *tp, 644 struct xfs_da_args *args,
645 struct xfs_inode *dp,
646 struct xfs_buf *bp, 645 struct xfs_buf *bp,
647 xfs_dir2_data_entry_t *dep) /* data entry pointer */ 646 xfs_dir2_data_entry_t *dep) /* data entry pointer */
648{ 647{
@@ -653,8 +652,8 @@ xfs_dir2_data_log_entry(
653 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 652 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
654 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 653 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
655 654
656 xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr), 655 xfs_trans_log_buf(args->trans, bp, (uint)((char *)dep - (char *)hdr),
657 (uint)((char *)(dp->d_ops->data_entry_tag_p(dep) + 1) - 656 (uint)((char *)(args->dp->d_ops->data_entry_tag_p(dep) + 1) -
658 (char *)hdr - 1)); 657 (char *)hdr - 1));
659} 658}
660 659
@@ -663,8 +662,7 @@ xfs_dir2_data_log_entry(
663 */ 662 */
664void 663void
665xfs_dir2_data_log_header( 664xfs_dir2_data_log_header(
666 struct xfs_trans *tp, 665 struct xfs_da_args *args,
667 struct xfs_inode *dp,
668 struct xfs_buf *bp) 666 struct xfs_buf *bp)
669{ 667{
670#ifdef DEBUG 668#ifdef DEBUG
@@ -676,7 +674,8 @@ xfs_dir2_data_log_header(
676 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 674 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
677#endif 675#endif
678 676
679 xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset - 1); 677 xfs_trans_log_buf(args->trans, bp, 0,
678 args->dp->d_ops->data_entry_offset - 1);
680} 679}
681 680
682/* 681/*
@@ -684,7 +683,7 @@ xfs_dir2_data_log_header(
684 */ 683 */
685void 684void
686xfs_dir2_data_log_unused( 685xfs_dir2_data_log_unused(
687 struct xfs_trans *tp, 686 struct xfs_da_args *args,
688 struct xfs_buf *bp, 687 struct xfs_buf *bp,
689 xfs_dir2_data_unused_t *dup) /* data unused pointer */ 688 xfs_dir2_data_unused_t *dup) /* data unused pointer */
690{ 689{
@@ -698,13 +697,13 @@ xfs_dir2_data_log_unused(
698 /* 697 /*
699 * Log the first part of the unused entry. 698 * Log the first part of the unused entry.
700 */ 699 */
701 xfs_trans_log_buf(tp, bp, (uint)((char *)dup - (char *)hdr), 700 xfs_trans_log_buf(args->trans, bp, (uint)((char *)dup - (char *)hdr),
702 (uint)((char *)&dup->length + sizeof(dup->length) - 701 (uint)((char *)&dup->length + sizeof(dup->length) -
703 1 - (char *)hdr)); 702 1 - (char *)hdr));
704 /* 703 /*
705 * Log the end (tag) of the unused entry. 704 * Log the end (tag) of the unused entry.
706 */ 705 */
707 xfs_trans_log_buf(tp, bp, 706 xfs_trans_log_buf(args->trans, bp,
708 (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr), 707 (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr),
709 (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr + 708 (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr +
710 sizeof(xfs_dir2_data_off_t) - 1)); 709 sizeof(xfs_dir2_data_off_t) - 1));
@@ -716,8 +715,7 @@ xfs_dir2_data_log_unused(
716 */ 715 */
717void 716void
718xfs_dir2_data_make_free( 717xfs_dir2_data_make_free(
719 struct xfs_trans *tp, 718 struct xfs_da_args *args,
720 struct xfs_inode *dp,
721 struct xfs_buf *bp, 719 struct xfs_buf *bp,
722 xfs_dir2_data_aoff_t offset, /* starting byte offset */ 720 xfs_dir2_data_aoff_t offset, /* starting byte offset */
723 xfs_dir2_data_aoff_t len, /* length in bytes */ 721 xfs_dir2_data_aoff_t len, /* length in bytes */
@@ -727,37 +725,33 @@ xfs_dir2_data_make_free(
727 xfs_dir2_data_hdr_t *hdr; /* data block pointer */ 725 xfs_dir2_data_hdr_t *hdr; /* data block pointer */
728 xfs_dir2_data_free_t *dfp; /* bestfree pointer */ 726 xfs_dir2_data_free_t *dfp; /* bestfree pointer */
729 char *endptr; /* end of data area */ 727 char *endptr; /* end of data area */
730 xfs_mount_t *mp; /* filesystem mount point */
731 int needscan; /* need to regen bestfree */ 728 int needscan; /* need to regen bestfree */
732 xfs_dir2_data_unused_t *newdup; /* new unused entry */ 729 xfs_dir2_data_unused_t *newdup; /* new unused entry */
733 xfs_dir2_data_unused_t *postdup; /* unused entry after us */ 730 xfs_dir2_data_unused_t *postdup; /* unused entry after us */
734 xfs_dir2_data_unused_t *prevdup; /* unused entry before us */ 731 xfs_dir2_data_unused_t *prevdup; /* unused entry before us */
735 struct xfs_dir2_data_free *bf; 732 struct xfs_dir2_data_free *bf;
736 struct xfs_da_geometry *geo;
737 733
738 mp = tp->t_mountp;
739 hdr = bp->b_addr; 734 hdr = bp->b_addr;
740 geo = mp->m_dir_geo;
741 735
742 /* 736 /*
743 * Figure out where the end of the data area is. 737 * Figure out where the end of the data area is.
744 */ 738 */
745 if (hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || 739 if (hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
746 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC)) 740 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC))
747 endptr = (char *)hdr + geo->blksize; 741 endptr = (char *)hdr + args->geo->blksize;
748 else { 742 else {
749 xfs_dir2_block_tail_t *btp; /* block tail */ 743 xfs_dir2_block_tail_t *btp; /* block tail */
750 744
751 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 745 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
752 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 746 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
753 btp = xfs_dir2_block_tail_p(geo, hdr); 747 btp = xfs_dir2_block_tail_p(args->geo, hdr);
754 endptr = (char *)xfs_dir2_block_leaf_p(btp); 748 endptr = (char *)xfs_dir2_block_leaf_p(btp);
755 } 749 }
756 /* 750 /*
757 * If this isn't the start of the block, then back up to 751 * If this isn't the start of the block, then back up to
758 * the previous entry and see if it's free. 752 * the previous entry and see if it's free.
759 */ 753 */
760 if (offset > dp->d_ops->data_entry_offset) { 754 if (offset > args->dp->d_ops->data_entry_offset) {
761 __be16 *tagp; /* tag just before us */ 755 __be16 *tagp; /* tag just before us */
762 756
763 tagp = (__be16 *)((char *)hdr + offset) - 1; 757 tagp = (__be16 *)((char *)hdr + offset) - 1;
@@ -783,7 +777,7 @@ xfs_dir2_data_make_free(
783 * Previous and following entries are both free, 777 * Previous and following entries are both free,
784 * merge everything into a single free entry. 778 * merge everything into a single free entry.
785 */ 779 */
786 bf = dp->d_ops->data_bestfree_p(hdr); 780 bf = args->dp->d_ops->data_bestfree_p(hdr);
787 if (prevdup && postdup) { 781 if (prevdup && postdup) {
788 xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */ 782 xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */
789 783
@@ -805,7 +799,7 @@ xfs_dir2_data_make_free(
805 be16_add_cpu(&prevdup->length, len + be16_to_cpu(postdup->length)); 799 be16_add_cpu(&prevdup->length, len + be16_to_cpu(postdup->length));
806 *xfs_dir2_data_unused_tag_p(prevdup) = 800 *xfs_dir2_data_unused_tag_p(prevdup) =
807 cpu_to_be16((char *)prevdup - (char *)hdr); 801 cpu_to_be16((char *)prevdup - (char *)hdr);
808 xfs_dir2_data_log_unused(tp, bp, prevdup); 802 xfs_dir2_data_log_unused(args, bp, prevdup);
809 if (!needscan) { 803 if (!needscan) {
810 /* 804 /*
811 * Has to be the case that entries 0 and 1 are 805 * Has to be the case that entries 0 and 1 are
@@ -840,7 +834,7 @@ xfs_dir2_data_make_free(
840 be16_add_cpu(&prevdup->length, len); 834 be16_add_cpu(&prevdup->length, len);
841 *xfs_dir2_data_unused_tag_p(prevdup) = 835 *xfs_dir2_data_unused_tag_p(prevdup) =
842 cpu_to_be16((char *)prevdup - (char *)hdr); 836 cpu_to_be16((char *)prevdup - (char *)hdr);
843 xfs_dir2_data_log_unused(tp, bp, prevdup); 837 xfs_dir2_data_log_unused(args, bp, prevdup);
844 /* 838 /*
845 * If the previous entry was in the table, the new entry 839 * If the previous entry was in the table, the new entry
846 * is longer, so it will be in the table too. Remove 840 * is longer, so it will be in the table too. Remove
@@ -868,7 +862,7 @@ xfs_dir2_data_make_free(
868 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); 862 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
869 *xfs_dir2_data_unused_tag_p(newdup) = 863 *xfs_dir2_data_unused_tag_p(newdup) =
870 cpu_to_be16((char *)newdup - (char *)hdr); 864 cpu_to_be16((char *)newdup - (char *)hdr);
871 xfs_dir2_data_log_unused(tp, bp, newdup); 865 xfs_dir2_data_log_unused(args, bp, newdup);
872 /* 866 /*
873 * If the following entry was in the table, the new entry 867 * If the following entry was in the table, the new entry
874 * is longer, so it will be in the table too. Remove 868 * is longer, so it will be in the table too. Remove
@@ -895,7 +889,7 @@ xfs_dir2_data_make_free(
895 newdup->length = cpu_to_be16(len); 889 newdup->length = cpu_to_be16(len);
896 *xfs_dir2_data_unused_tag_p(newdup) = 890 *xfs_dir2_data_unused_tag_p(newdup) =
897 cpu_to_be16((char *)newdup - (char *)hdr); 891 cpu_to_be16((char *)newdup - (char *)hdr);
898 xfs_dir2_data_log_unused(tp, bp, newdup); 892 xfs_dir2_data_log_unused(args, bp, newdup);
899 xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp); 893 xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp);
900 } 894 }
901 *needscanp = needscan; 895 *needscanp = needscan;
@@ -906,8 +900,7 @@ xfs_dir2_data_make_free(
906 */ 900 */
907void 901void
908xfs_dir2_data_use_free( 902xfs_dir2_data_use_free(
909 struct xfs_trans *tp, 903 struct xfs_da_args *args,
910 struct xfs_inode *dp,
911 struct xfs_buf *bp, 904 struct xfs_buf *bp,
912 xfs_dir2_data_unused_t *dup, /* unused entry */ 905 xfs_dir2_data_unused_t *dup, /* unused entry */
913 xfs_dir2_data_aoff_t offset, /* starting offset to use */ 906 xfs_dir2_data_aoff_t offset, /* starting offset to use */
@@ -938,7 +931,7 @@ xfs_dir2_data_use_free(
938 * Look up the entry in the bestfree table. 931 * Look up the entry in the bestfree table.
939 */ 932 */
940 oldlen = be16_to_cpu(dup->length); 933 oldlen = be16_to_cpu(dup->length);
941 bf = dp->d_ops->data_bestfree_p(hdr); 934 bf = args->dp->d_ops->data_bestfree_p(hdr);
942 dfp = xfs_dir2_data_freefind(hdr, bf, dup); 935 dfp = xfs_dir2_data_freefind(hdr, bf, dup);
943 ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length)); 936 ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length));
944 /* 937 /*
@@ -970,7 +963,7 @@ xfs_dir2_data_use_free(
970 newdup->length = cpu_to_be16(oldlen - len); 963 newdup->length = cpu_to_be16(oldlen - len);
971 *xfs_dir2_data_unused_tag_p(newdup) = 964 *xfs_dir2_data_unused_tag_p(newdup) =
972 cpu_to_be16((char *)newdup - (char *)hdr); 965 cpu_to_be16((char *)newdup - (char *)hdr);
973 xfs_dir2_data_log_unused(tp, bp, newdup); 966 xfs_dir2_data_log_unused(args, bp, newdup);
974 /* 967 /*
975 * If it was in the table, remove it and add the new one. 968 * If it was in the table, remove it and add the new one.
976 */ 969 */
@@ -998,7 +991,7 @@ xfs_dir2_data_use_free(
998 newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup); 991 newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup);
999 *xfs_dir2_data_unused_tag_p(newdup) = 992 *xfs_dir2_data_unused_tag_p(newdup) =
1000 cpu_to_be16((char *)newdup - (char *)hdr); 993 cpu_to_be16((char *)newdup - (char *)hdr);
1001 xfs_dir2_data_log_unused(tp, bp, newdup); 994 xfs_dir2_data_log_unused(args, bp, newdup);
1002 /* 995 /*
1003 * If it was in the table, remove it and add the new one. 996 * If it was in the table, remove it and add the new one.
1004 */ 997 */
@@ -1026,13 +1019,13 @@ xfs_dir2_data_use_free(
1026 newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup); 1019 newdup->length = cpu_to_be16(((char *)hdr + offset) - (char *)newdup);
1027 *xfs_dir2_data_unused_tag_p(newdup) = 1020 *xfs_dir2_data_unused_tag_p(newdup) =
1028 cpu_to_be16((char *)newdup - (char *)hdr); 1021 cpu_to_be16((char *)newdup - (char *)hdr);
1029 xfs_dir2_data_log_unused(tp, bp, newdup); 1022 xfs_dir2_data_log_unused(args, bp, newdup);
1030 newdup2 = (xfs_dir2_data_unused_t *)((char *)hdr + offset + len); 1023 newdup2 = (xfs_dir2_data_unused_t *)((char *)hdr + offset + len);
1031 newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 1024 newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
1032 newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length)); 1025 newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length));
1033 *xfs_dir2_data_unused_tag_p(newdup2) = 1026 *xfs_dir2_data_unused_tag_p(newdup2) =
1034 cpu_to_be16((char *)newdup2 - (char *)hdr); 1027 cpu_to_be16((char *)newdup2 - (char *)hdr);
1035 xfs_dir2_data_log_unused(tp, bp, newdup2); 1028 xfs_dir2_data_log_unused(args, bp, newdup2);
1036 /* 1029 /*
1037 * If the old entry was in the table, we need to scan 1030 * If the old entry was in the table, we need to scan
1038 * if the 3rd entry was valid, since these entries 1031 * if the 3rd entry was valid, since these entries
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index e517bd0544cd..fb0aad4440c1 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -41,9 +41,10 @@
41 */ 41 */
42static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp, 42static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp,
43 int *indexp, struct xfs_buf **dbpp); 43 int *indexp, struct xfs_buf **dbpp);
44static void xfs_dir3_leaf_log_bests(struct xfs_trans *tp, struct xfs_buf *bp, 44static void xfs_dir3_leaf_log_bests(struct xfs_da_args *args,
45 int first, int last); 45 struct xfs_buf *bp, int first, int last);
46static void xfs_dir3_leaf_log_tail(struct xfs_trans *tp, struct xfs_buf *bp); 46static void xfs_dir3_leaf_log_tail(struct xfs_da_args *args,
47 struct xfs_buf *bp);
47 48
48/* 49/*
49 * Check the internal consistency of a leaf1 block. 50 * Check the internal consistency of a leaf1 block.
@@ -357,9 +358,9 @@ xfs_dir3_leaf_get_buf(
357 return error; 358 return error;
358 359
359 xfs_dir3_leaf_init(mp, tp, bp, dp->i_ino, magic); 360 xfs_dir3_leaf_init(mp, tp, bp, dp->i_ino, magic);
360 xfs_dir3_leaf_log_header(tp, dp, bp); 361 xfs_dir3_leaf_log_header(args, bp);
361 if (magic == XFS_DIR2_LEAF1_MAGIC) 362 if (magic == XFS_DIR2_LEAF1_MAGIC)
362 xfs_dir3_leaf_log_tail(tp, bp); 363 xfs_dir3_leaf_log_tail(args, bp);
363 *bpp = bp; 364 *bpp = bp;
364 return 0; 365 return 0;
365} 366}
@@ -428,21 +429,21 @@ xfs_dir2_block_to_leaf(
428 leafhdr.count = be32_to_cpu(btp->count); 429 leafhdr.count = be32_to_cpu(btp->count);
429 leafhdr.stale = be32_to_cpu(btp->stale); 430 leafhdr.stale = be32_to_cpu(btp->stale);
430 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); 431 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
431 xfs_dir3_leaf_log_header(tp, dp, lbp); 432 xfs_dir3_leaf_log_header(args, lbp);
432 433
433 /* 434 /*
434 * Could compact these but I think we always do the conversion 435 * Could compact these but I think we always do the conversion
435 * after squeezing out stale entries. 436 * after squeezing out stale entries.
436 */ 437 */
437 memcpy(ents, blp, be32_to_cpu(btp->count) * sizeof(xfs_dir2_leaf_entry_t)); 438 memcpy(ents, blp, be32_to_cpu(btp->count) * sizeof(xfs_dir2_leaf_entry_t));
438 xfs_dir3_leaf_log_ents(tp, dp, lbp, 0, leafhdr.count - 1); 439 xfs_dir3_leaf_log_ents(args, lbp, 0, leafhdr.count - 1);
439 needscan = 0; 440 needscan = 0;
440 needlog = 1; 441 needlog = 1;
441 /* 442 /*
442 * Make the space formerly occupied by the leaf entries and block 443 * Make the space formerly occupied by the leaf entries and block
443 * tail be free. 444 * tail be free.
444 */ 445 */
445 xfs_dir2_data_make_free(tp, dp, dbp, 446 xfs_dir2_data_make_free(args, dbp,
446 (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr), 447 (xfs_dir2_data_aoff_t)((char *)blp - (char *)hdr),
447 (xfs_dir2_data_aoff_t)((char *)hdr + args->geo->blksize - 448 (xfs_dir2_data_aoff_t)((char *)hdr + args->geo->blksize -
448 (char *)blp), 449 (char *)blp),
@@ -470,10 +471,10 @@ xfs_dir2_block_to_leaf(
470 * Log the data header and leaf bests table. 471 * Log the data header and leaf bests table.
471 */ 472 */
472 if (needlog) 473 if (needlog)
473 xfs_dir2_data_log_header(tp, dp, dbp); 474 xfs_dir2_data_log_header(args, dbp);
474 xfs_dir3_leaf_check(dp, lbp); 475 xfs_dir3_leaf_check(dp, lbp);
475 xfs_dir3_data_check(dp, dbp); 476 xfs_dir3_data_check(dp, dbp);
476 xfs_dir3_leaf_log_bests(tp, lbp, 0, 0); 477 xfs_dir3_leaf_log_bests(args, lbp, 0, 0);
477 return 0; 478 return 0;
478} 479}
479 480
@@ -811,14 +812,15 @@ xfs_dir2_leaf_addname(
811 memmove(&bestsp[0], &bestsp[1], 812 memmove(&bestsp[0], &bestsp[1],
812 be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0])); 813 be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0]));
813 be32_add_cpu(&ltp->bestcount, 1); 814 be32_add_cpu(&ltp->bestcount, 1);
814 xfs_dir3_leaf_log_tail(tp, lbp); 815 xfs_dir3_leaf_log_tail(args, lbp);
815 xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 816 xfs_dir3_leaf_log_bests(args, lbp, 0,
817 be32_to_cpu(ltp->bestcount) - 1);
816 } 818 }
817 /* 819 /*
818 * If we're filling in a previously empty block just log it. 820 * If we're filling in a previously empty block just log it.
819 */ 821 */
820 else 822 else
821 xfs_dir3_leaf_log_bests(tp, lbp, use_block, use_block); 823 xfs_dir3_leaf_log_bests(args, lbp, use_block, use_block);
822 hdr = dbp->b_addr; 824 hdr = dbp->b_addr;
823 bf = dp->d_ops->data_bestfree_p(hdr); 825 bf = dp->d_ops->data_bestfree_p(hdr);
824 bestsp[use_block] = bf[0].length; 826 bestsp[use_block] = bf[0].length;
@@ -849,7 +851,7 @@ xfs_dir2_leaf_addname(
849 /* 851 /*
850 * Mark the initial part of our freespace in use for the new entry. 852 * Mark the initial part of our freespace in use for the new entry.
851 */ 853 */
852 xfs_dir2_data_use_free(tp, dp, dbp, dup, 854 xfs_dir2_data_use_free(args, dbp, dup,
853 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, 855 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length,
854 &needlog, &needscan); 856 &needlog, &needscan);
855 /* 857 /*
@@ -871,8 +873,8 @@ xfs_dir2_leaf_addname(
871 * Need to log the data block's header. 873 * Need to log the data block's header.
872 */ 874 */
873 if (needlog) 875 if (needlog)
874 xfs_dir2_data_log_header(tp, dp, dbp); 876 xfs_dir2_data_log_header(args, dbp);
875 xfs_dir2_data_log_entry(tp, dp, dbp, dep); 877 xfs_dir2_data_log_entry(args, dbp, dep);
876 /* 878 /*
877 * If the bests table needs to be changed, do it. 879 * If the bests table needs to be changed, do it.
878 * Log the change unless we've already done that. 880 * Log the change unless we've already done that.
@@ -880,7 +882,7 @@ xfs_dir2_leaf_addname(
880 if (be16_to_cpu(bestsp[use_block]) != be16_to_cpu(bf[0].length)) { 882 if (be16_to_cpu(bestsp[use_block]) != be16_to_cpu(bf[0].length)) {
881 bestsp[use_block] = bf[0].length; 883 bestsp[use_block] = bf[0].length;
882 if (!grown) 884 if (!grown)
883 xfs_dir3_leaf_log_bests(tp, lbp, use_block, use_block); 885 xfs_dir3_leaf_log_bests(args, lbp, use_block, use_block);
884 } 886 }
885 887
886 lep = xfs_dir3_leaf_find_entry(&leafhdr, ents, index, compact, lowstale, 888 lep = xfs_dir3_leaf_find_entry(&leafhdr, ents, index, compact, lowstale,
@@ -897,8 +899,8 @@ xfs_dir2_leaf_addname(
897 * Log the leaf fields and give up the buffers. 899 * Log the leaf fields and give up the buffers.
898 */ 900 */
899 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); 901 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
900 xfs_dir3_leaf_log_header(tp, dp, lbp); 902 xfs_dir3_leaf_log_header(args, lbp);
901 xfs_dir3_leaf_log_ents(tp, dp, lbp, lfloglow, lfloghigh); 903 xfs_dir3_leaf_log_ents(args, lbp, lfloglow, lfloghigh);
902 xfs_dir3_leaf_check(dp, lbp); 904 xfs_dir3_leaf_check(dp, lbp);
903 xfs_dir3_data_check(dp, dbp); 905 xfs_dir3_data_check(dp, dbp);
904 return 0; 906 return 0;
@@ -950,9 +952,9 @@ xfs_dir3_leaf_compact(
950 leafhdr->stale = 0; 952 leafhdr->stale = 0;
951 953
952 dp->d_ops->leaf_hdr_to_disk(leaf, leafhdr); 954 dp->d_ops->leaf_hdr_to_disk(leaf, leafhdr);
953 xfs_dir3_leaf_log_header(args->trans, dp, bp); 955 xfs_dir3_leaf_log_header(args, bp);
954 if (loglow != -1) 956 if (loglow != -1)
955 xfs_dir3_leaf_log_ents(args->trans, dp, bp, loglow, to - 1); 957 xfs_dir3_leaf_log_ents(args, bp, loglow, to - 1);
956} 958}
957 959
958/* 960/*
@@ -1054,7 +1056,7 @@ xfs_dir3_leaf_compact_x1(
1054 */ 1056 */
1055static void 1057static void
1056xfs_dir3_leaf_log_bests( 1058xfs_dir3_leaf_log_bests(
1057 xfs_trans_t *tp, /* transaction pointer */ 1059 struct xfs_da_args *args,
1058 struct xfs_buf *bp, /* leaf buffer */ 1060 struct xfs_buf *bp, /* leaf buffer */
1059 int first, /* first entry to log */ 1061 int first, /* first entry to log */
1060 int last) /* last entry to log */ 1062 int last) /* last entry to log */
@@ -1067,10 +1069,11 @@ xfs_dir3_leaf_log_bests(
1067 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || 1069 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
1068 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC)); 1070 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC));
1069 1071
1070 ltp = xfs_dir2_leaf_tail_p(tp->t_mountp->m_dir_geo, leaf); 1072 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
1071 firstb = xfs_dir2_leaf_bests_p(ltp) + first; 1073 firstb = xfs_dir2_leaf_bests_p(ltp) + first;
1072 lastb = xfs_dir2_leaf_bests_p(ltp) + last; 1074 lastb = xfs_dir2_leaf_bests_p(ltp) + last;
1073 xfs_trans_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf), 1075 xfs_trans_log_buf(args->trans, bp,
1076 (uint)((char *)firstb - (char *)leaf),
1074 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1)); 1077 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1));
1075} 1078}
1076 1079
@@ -1079,8 +1082,7 @@ xfs_dir3_leaf_log_bests(
1079 */ 1082 */
1080void 1083void
1081xfs_dir3_leaf_log_ents( 1084xfs_dir3_leaf_log_ents(
1082 struct xfs_trans *tp, 1085 struct xfs_da_args *args,
1083 struct xfs_inode *dp,
1084 struct xfs_buf *bp, 1086 struct xfs_buf *bp,
1085 int first, 1087 int first,
1086 int last) 1088 int last)
@@ -1095,10 +1097,11 @@ xfs_dir3_leaf_log_ents(
1095 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || 1097 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
1096 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); 1098 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
1097 1099
1098 ents = dp->d_ops->leaf_ents_p(leaf); 1100 ents = args->dp->d_ops->leaf_ents_p(leaf);
1099 firstlep = &ents[first]; 1101 firstlep = &ents[first];
1100 lastlep = &ents[last]; 1102 lastlep = &ents[last];
1101 xfs_trans_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf), 1103 xfs_trans_log_buf(args->trans, bp,
1104 (uint)((char *)firstlep - (char *)leaf),
1102 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1)); 1105 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1));
1103} 1106}
1104 1107
@@ -1107,8 +1110,7 @@ xfs_dir3_leaf_log_ents(
1107 */ 1110 */
1108void 1111void
1109xfs_dir3_leaf_log_header( 1112xfs_dir3_leaf_log_header(
1110 struct xfs_trans *tp, 1113 struct xfs_da_args *args,
1111 struct xfs_inode *dp,
1112 struct xfs_buf *bp) 1114 struct xfs_buf *bp)
1113{ 1115{
1114 struct xfs_dir2_leaf *leaf = bp->b_addr; 1116 struct xfs_dir2_leaf *leaf = bp->b_addr;
@@ -1118,8 +1120,9 @@ xfs_dir3_leaf_log_header(
1118 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || 1120 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
1119 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); 1121 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
1120 1122
1121 xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf), 1123 xfs_trans_log_buf(args->trans, bp,
1122 dp->d_ops->leaf_hdr_size - 1); 1124 (uint)((char *)&leaf->hdr - (char *)leaf),
1125 args->dp->d_ops->leaf_hdr_size - 1);
1123} 1126}
1124 1127
1125/* 1128/*
@@ -1127,21 +1130,20 @@ xfs_dir3_leaf_log_header(
1127 */ 1130 */
1128STATIC void 1131STATIC void
1129xfs_dir3_leaf_log_tail( 1132xfs_dir3_leaf_log_tail(
1130 struct xfs_trans *tp, 1133 struct xfs_da_args *args,
1131 struct xfs_buf *bp) 1134 struct xfs_buf *bp)
1132{ 1135{
1133 struct xfs_dir2_leaf *leaf = bp->b_addr; 1136 struct xfs_dir2_leaf *leaf = bp->b_addr;
1134 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ 1137 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
1135 struct xfs_mount *mp = tp->t_mountp;
1136 1138
1137 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || 1139 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
1138 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) || 1140 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAF1_MAGIC) ||
1139 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) || 1141 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
1140 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC)); 1142 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR3_LEAFN_MAGIC));
1141 1143
1142 ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf); 1144 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
1143 xfs_trans_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf), 1145 xfs_trans_log_buf(args->trans, bp, (uint)((char *)ltp - (char *)leaf),
1144 (uint)(mp->m_dir_geo->blksize - 1)); 1146 (uint)(args->geo->blksize - 1));
1145} 1147}
1146 1148
1147/* 1149/*
@@ -1395,7 +1397,7 @@ xfs_dir2_leaf_removename(
1395 /* 1397 /*
1396 * Mark the former data entry unused. 1398 * Mark the former data entry unused.
1397 */ 1399 */
1398 xfs_dir2_data_make_free(tp, dp, dbp, 1400 xfs_dir2_data_make_free(args, dbp,
1399 (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr), 1401 (xfs_dir2_data_aoff_t)((char *)dep - (char *)hdr),
1400 dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); 1402 dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
1401 /* 1403 /*
@@ -1403,10 +1405,10 @@ xfs_dir2_leaf_removename(
1403 */ 1405 */
1404 leafhdr.stale++; 1406 leafhdr.stale++;
1405 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); 1407 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
1406 xfs_dir3_leaf_log_header(tp, dp, lbp); 1408 xfs_dir3_leaf_log_header(args, lbp);
1407 1409
1408 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); 1410 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
1409 xfs_dir3_leaf_log_ents(tp, dp, lbp, index, index); 1411 xfs_dir3_leaf_log_ents(args, lbp, index, index);
1410 1412
1411 /* 1413 /*
1412 * Scan the freespace in the data block again if necessary, 1414 * Scan the freespace in the data block again if necessary,
@@ -1415,14 +1417,14 @@ xfs_dir2_leaf_removename(
1415 if (needscan) 1417 if (needscan)
1416 xfs_dir2_data_freescan(dp, hdr, &needlog); 1418 xfs_dir2_data_freescan(dp, hdr, &needlog);
1417 if (needlog) 1419 if (needlog)
1418 xfs_dir2_data_log_header(tp, dp, dbp); 1420 xfs_dir2_data_log_header(args, dbp);
1419 /* 1421 /*
1420 * If the longest freespace in the data block has changed, 1422 * If the longest freespace in the data block has changed,
1421 * put the new value in the bests table and log that. 1423 * put the new value in the bests table and log that.
1422 */ 1424 */
1423 if (be16_to_cpu(bf[0].length) != oldbest) { 1425 if (be16_to_cpu(bf[0].length) != oldbest) {
1424 bestsp[db] = bf[0].length; 1426 bestsp[db] = bf[0].length;
1425 xfs_dir3_leaf_log_bests(tp, lbp, db, db); 1427 xfs_dir3_leaf_log_bests(args, lbp, db, db);
1426 } 1428 }
1427 xfs_dir3_data_check(dp, dbp); 1429 xfs_dir3_data_check(dp, dbp);
1428 /* 1430 /*
@@ -1463,8 +1465,9 @@ xfs_dir2_leaf_removename(
1463 memmove(&bestsp[db - i], bestsp, 1465 memmove(&bestsp[db - i], bestsp,
1464 (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp)); 1466 (be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp));
1465 be32_add_cpu(&ltp->bestcount, -(db - i)); 1467 be32_add_cpu(&ltp->bestcount, -(db - i));
1466 xfs_dir3_leaf_log_tail(tp, lbp); 1468 xfs_dir3_leaf_log_tail(args, lbp);
1467 xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1469 xfs_dir3_leaf_log_bests(args, lbp, 0,
1470 be32_to_cpu(ltp->bestcount) - 1);
1468 } else 1471 } else
1469 bestsp[db] = cpu_to_be16(NULLDATAOFF); 1472 bestsp[db] = cpu_to_be16(NULLDATAOFF);
1470 } 1473 }
@@ -1527,7 +1530,7 @@ xfs_dir2_leaf_replace(
1527 dep->inumber = cpu_to_be64(args->inumber); 1530 dep->inumber = cpu_to_be64(args->inumber);
1528 dp->d_ops->data_put_ftype(dep, args->filetype); 1531 dp->d_ops->data_put_ftype(dep, args->filetype);
1529 tp = args->trans; 1532 tp = args->trans;
1530 xfs_dir2_data_log_entry(tp, dp, dbp, dep); 1533 xfs_dir2_data_log_entry(args, dbp, dep);
1531 xfs_dir3_leaf_check(dp, lbp); 1534 xfs_dir3_leaf_check(dp, lbp);
1532 xfs_trans_brelse(tp, lbp); 1535 xfs_trans_brelse(tp, lbp);
1533 return 0; 1536 return 0;
@@ -1648,8 +1651,8 @@ xfs_dir2_leaf_trim_data(
1648 bestsp = xfs_dir2_leaf_bests_p(ltp); 1651 bestsp = xfs_dir2_leaf_bests_p(ltp);
1649 be32_add_cpu(&ltp->bestcount, -1); 1652 be32_add_cpu(&ltp->bestcount, -1);
1650 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp)); 1653 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp));
1651 xfs_dir3_leaf_log_tail(tp, lbp); 1654 xfs_dir3_leaf_log_tail(args, lbp);
1652 xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1655 xfs_dir3_leaf_log_bests(args, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
1653 return 0; 1656 return 0;
1654} 1657}
1655 1658
@@ -1795,9 +1798,9 @@ xfs_dir2_node_to_leaf(
1795 freehdr.nvalid * sizeof(xfs_dir2_data_off_t)); 1798 freehdr.nvalid * sizeof(xfs_dir2_data_off_t));
1796 1799
1797 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); 1800 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
1798 xfs_dir3_leaf_log_header(tp, dp, lbp); 1801 xfs_dir3_leaf_log_header(args, lbp);
1799 xfs_dir3_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1); 1802 xfs_dir3_leaf_log_bests(args, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
1800 xfs_dir3_leaf_log_tail(tp, lbp); 1803 xfs_dir3_leaf_log_tail(args, lbp);
1801 xfs_dir3_leaf_check(dp, lbp); 1804 xfs_dir3_leaf_check(dp, lbp);
1802 1805
1803 /* 1806 /*
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index eff6b8d67dab..65df8cbedbb7 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -241,8 +241,7 @@ xfs_dir3_free_get_buf(
241 */ 241 */
242STATIC void 242STATIC void
243xfs_dir2_free_log_bests( 243xfs_dir2_free_log_bests(
244 struct xfs_trans *tp, 244 struct xfs_da_args *args,
245 struct xfs_inode *dp,
246 struct xfs_buf *bp, 245 struct xfs_buf *bp,
247 int first, /* first entry to log */ 246 int first, /* first entry to log */
248 int last) /* last entry to log */ 247 int last) /* last entry to log */
@@ -251,10 +250,10 @@ xfs_dir2_free_log_bests(
251 __be16 *bests; 250 __be16 *bests;
252 251
253 free = bp->b_addr; 252 free = bp->b_addr;
254 bests = dp->d_ops->free_bests_p(free); 253 bests = args->dp->d_ops->free_bests_p(free);
255 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || 254 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
256 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); 255 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
257 xfs_trans_log_buf(tp, bp, 256 xfs_trans_log_buf(args->trans, bp,
258 (uint)((char *)&bests[first] - (char *)free), 257 (uint)((char *)&bests[first] - (char *)free),
259 (uint)((char *)&bests[last] - (char *)free + 258 (uint)((char *)&bests[last] - (char *)free +
260 sizeof(bests[0]) - 1)); 259 sizeof(bests[0]) - 1));
@@ -265,8 +264,7 @@ xfs_dir2_free_log_bests(
265 */ 264 */
266static void 265static void
267xfs_dir2_free_log_header( 266xfs_dir2_free_log_header(
268 struct xfs_trans *tp, 267 struct xfs_da_args *args,
269 struct xfs_inode *dp,
270 struct xfs_buf *bp) 268 struct xfs_buf *bp)
271{ 269{
272#ifdef DEBUG 270#ifdef DEBUG
@@ -276,7 +274,8 @@ xfs_dir2_free_log_header(
276 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) || 274 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC) ||
277 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC)); 275 free->hdr.magic == cpu_to_be32(XFS_DIR3_FREE_MAGIC));
278#endif 276#endif
279 xfs_trans_log_buf(tp, bp, 0, dp->d_ops->free_hdr_size - 1); 277 xfs_trans_log_buf(args->trans, bp, 0,
278 args->dp->d_ops->free_hdr_size - 1);
280} 279}
281 280
282/* 281/*
@@ -350,8 +349,8 @@ xfs_dir2_leaf_to_node(
350 freehdr.nvalid = be32_to_cpu(ltp->bestcount); 349 freehdr.nvalid = be32_to_cpu(ltp->bestcount);
351 350
352 dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr); 351 dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr);
353 xfs_dir2_free_log_bests(tp, dp, fbp, 0, freehdr.nvalid - 1); 352 xfs_dir2_free_log_bests(args, fbp, 0, freehdr.nvalid - 1);
354 xfs_dir2_free_log_header(tp, dp, fbp); 353 xfs_dir2_free_log_header(args, fbp);
355 354
356 /* 355 /*
357 * Converting the leaf to a leafnode is just a matter of changing the 356 * Converting the leaf to a leafnode is just a matter of changing the
@@ -365,7 +364,7 @@ xfs_dir2_leaf_to_node(
365 leaf->hdr.info.magic = cpu_to_be16(XFS_DIR3_LEAFN_MAGIC); 364 leaf->hdr.info.magic = cpu_to_be16(XFS_DIR3_LEAFN_MAGIC);
366 lbp->b_ops = &xfs_dir3_leafn_buf_ops; 365 lbp->b_ops = &xfs_dir3_leafn_buf_ops;
367 xfs_trans_buf_set_type(tp, lbp, XFS_BLFT_DIR_LEAFN_BUF); 366 xfs_trans_buf_set_type(tp, lbp, XFS_BLFT_DIR_LEAFN_BUF);
368 xfs_dir3_leaf_log_header(tp, dp, lbp); 367 xfs_dir3_leaf_log_header(args, lbp);
369 xfs_dir3_leaf_check(dp, lbp); 368 xfs_dir3_leaf_check(dp, lbp);
370 return 0; 369 return 0;
371} 370}
@@ -455,8 +454,8 @@ xfs_dir2_leafn_add(
455 args->blkno, args->index)); 454 args->blkno, args->index));
456 455
457 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); 456 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
458 xfs_dir3_leaf_log_header(tp, dp, bp); 457 xfs_dir3_leaf_log_header(args, bp);
459 xfs_dir3_leaf_log_ents(tp, dp, bp, lfloglow, lfloghigh); 458 xfs_dir3_leaf_log_ents(args, bp, lfloglow, lfloghigh);
460 xfs_dir3_leaf_check(dp, bp); 459 xfs_dir3_leaf_check(dp, bp);
461 return 0; 460 return 0;
462} 461}
@@ -851,7 +850,6 @@ xfs_dir3_leafn_moveents(
851 int start_d,/* destination leaf index */ 850 int start_d,/* destination leaf index */
852 int count) /* count of leaves to copy */ 851 int count) /* count of leaves to copy */
853{ 852{
854 struct xfs_trans *tp = args->trans;
855 int stale; /* count stale leaves copied */ 853 int stale; /* count stale leaves copied */
856 854
857 trace_xfs_dir2_leafn_moveents(args, start_s, start_d, count); 855 trace_xfs_dir2_leafn_moveents(args, start_s, start_d, count);
@@ -870,7 +868,7 @@ xfs_dir3_leafn_moveents(
870 if (start_d < dhdr->count) { 868 if (start_d < dhdr->count) {
871 memmove(&dents[start_d + count], &dents[start_d], 869 memmove(&dents[start_d + count], &dents[start_d],
872 (dhdr->count - start_d) * sizeof(xfs_dir2_leaf_entry_t)); 870 (dhdr->count - start_d) * sizeof(xfs_dir2_leaf_entry_t));
873 xfs_dir3_leaf_log_ents(tp, args->dp, bp_d, start_d + count, 871 xfs_dir3_leaf_log_ents(args, bp_d, start_d + count,
874 count + dhdr->count - 1); 872 count + dhdr->count - 1);
875 } 873 }
876 /* 874 /*
@@ -892,8 +890,7 @@ xfs_dir3_leafn_moveents(
892 */ 890 */
893 memcpy(&dents[start_d], &sents[start_s], 891 memcpy(&dents[start_d], &sents[start_s],
894 count * sizeof(xfs_dir2_leaf_entry_t)); 892 count * sizeof(xfs_dir2_leaf_entry_t));
895 xfs_dir3_leaf_log_ents(tp, args->dp, bp_d, 893 xfs_dir3_leaf_log_ents(args, bp_d, start_d, start_d + count - 1);
896 start_d, start_d + count - 1);
897 894
898 /* 895 /*
899 * If there are source entries after the ones we copied, 896 * If there are source entries after the ones we copied,
@@ -902,8 +899,7 @@ xfs_dir3_leafn_moveents(
902 if (start_s + count < shdr->count) { 899 if (start_s + count < shdr->count) {
903 memmove(&sents[start_s], &sents[start_s + count], 900 memmove(&sents[start_s], &sents[start_s + count],
904 count * sizeof(xfs_dir2_leaf_entry_t)); 901 count * sizeof(xfs_dir2_leaf_entry_t));
905 xfs_dir3_leaf_log_ents(tp, args->dp, bp_s, 902 xfs_dir3_leaf_log_ents(args, bp_s, start_s, start_s + count - 1);
906 start_s, start_s + count - 1);
907 } 903 }
908 904
909 /* 905 /*
@@ -1039,8 +1035,8 @@ xfs_dir2_leafn_rebalance(
1039 /* log the changes made when moving the entries */ 1035 /* log the changes made when moving the entries */
1040 dp->d_ops->leaf_hdr_to_disk(leaf1, &hdr1); 1036 dp->d_ops->leaf_hdr_to_disk(leaf1, &hdr1);
1041 dp->d_ops->leaf_hdr_to_disk(leaf2, &hdr2); 1037 dp->d_ops->leaf_hdr_to_disk(leaf2, &hdr2);
1042 xfs_dir3_leaf_log_header(args->trans, dp, blk1->bp); 1038 xfs_dir3_leaf_log_header(args, blk1->bp);
1043 xfs_dir3_leaf_log_header(args->trans, dp, blk2->bp); 1039 xfs_dir3_leaf_log_header(args, blk2->bp);
1044 1040
1045 xfs_dir3_leaf_check(dp, blk1->bp); 1041 xfs_dir3_leaf_check(dp, blk1->bp);
1046 xfs_dir3_leaf_check(dp, blk2->bp); 1042 xfs_dir3_leaf_check(dp, blk2->bp);
@@ -1083,7 +1079,6 @@ xfs_dir3_data_block_free(
1083 struct xfs_buf *fbp, 1079 struct xfs_buf *fbp,
1084 int longest) 1080 int longest)
1085{ 1081{
1086 struct xfs_trans *tp = args->trans;
1087 int logfree = 0; 1082 int logfree = 0;
1088 __be16 *bests; 1083 __be16 *bests;
1089 struct xfs_dir3_icfree_hdr freehdr; 1084 struct xfs_dir3_icfree_hdr freehdr;
@@ -1097,7 +1092,7 @@ xfs_dir3_data_block_free(
1097 * value. 1092 * value.
1098 */ 1093 */
1099 bests[findex] = cpu_to_be16(longest); 1094 bests[findex] = cpu_to_be16(longest);
1100 xfs_dir2_free_log_bests(tp, dp, fbp, findex, findex); 1095 xfs_dir2_free_log_bests(args, fbp, findex, findex);
1101 return 0; 1096 return 0;
1102 } 1097 }
1103 1098
@@ -1125,7 +1120,7 @@ xfs_dir3_data_block_free(
1125 } 1120 }
1126 1121
1127 dp->d_ops->free_hdr_to_disk(free, &freehdr); 1122 dp->d_ops->free_hdr_to_disk(free, &freehdr);
1128 xfs_dir2_free_log_header(tp, dp, fbp); 1123 xfs_dir2_free_log_header(args, fbp);
1129 1124
1130 /* 1125 /*
1131 * If there are no useful entries left in the block, get rid of the 1126 * If there are no useful entries left in the block, get rid of the
@@ -1149,7 +1144,7 @@ xfs_dir3_data_block_free(
1149 1144
1150 /* Log the free entry that changed, unless we got rid of it. */ 1145 /* Log the free entry that changed, unless we got rid of it. */
1151 if (logfree) 1146 if (logfree)
1152 xfs_dir2_free_log_bests(tp, dp, fbp, findex, findex); 1147 xfs_dir2_free_log_bests(args, fbp, findex, findex);
1153 return 0; 1148 return 0;
1154} 1149}
1155 1150
@@ -1211,10 +1206,10 @@ xfs_dir2_leafn_remove(
1211 */ 1206 */
1212 leafhdr.stale++; 1207 leafhdr.stale++;
1213 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr); 1208 dp->d_ops->leaf_hdr_to_disk(leaf, &leafhdr);
1214 xfs_dir3_leaf_log_header(tp, dp, bp); 1209 xfs_dir3_leaf_log_header(args, bp);
1215 1210
1216 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); 1211 lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR);
1217 xfs_dir3_leaf_log_ents(tp, dp, bp, index, index); 1212 xfs_dir3_leaf_log_ents(args, bp, index, index);
1218 1213
1219 /* 1214 /*
1220 * Make the data entry free. Keep track of the longest freespace 1215 * Make the data entry free. Keep track of the longest freespace
@@ -1226,7 +1221,7 @@ xfs_dir2_leafn_remove(
1226 bf = dp->d_ops->data_bestfree_p(hdr); 1221 bf = dp->d_ops->data_bestfree_p(hdr);
1227 longest = be16_to_cpu(bf[0].length); 1222 longest = be16_to_cpu(bf[0].length);
1228 needlog = needscan = 0; 1223 needlog = needscan = 0;
1229 xfs_dir2_data_make_free(tp, dp, dbp, off, 1224 xfs_dir2_data_make_free(args, dbp, off,
1230 dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan); 1225 dp->d_ops->data_entsize(dep->namelen), &needlog, &needscan);
1231 /* 1226 /*
1232 * Rescan the data block freespaces for bestfree. 1227 * Rescan the data block freespaces for bestfree.
@@ -1235,7 +1230,7 @@ xfs_dir2_leafn_remove(
1235 if (needscan) 1230 if (needscan)
1236 xfs_dir2_data_freescan(dp, hdr, &needlog); 1231 xfs_dir2_data_freescan(dp, hdr, &needlog);
1237 if (needlog) 1232 if (needlog)
1238 xfs_dir2_data_log_header(tp, dp, dbp); 1233 xfs_dir2_data_log_header(args, dbp);
1239 xfs_dir3_data_check(dp, dbp); 1234 xfs_dir3_data_check(dp, dbp);
1240 /* 1235 /*
1241 * If the longest data block freespace changes, need to update 1236 * If the longest data block freespace changes, need to update
@@ -1569,8 +1564,8 @@ xfs_dir2_leafn_unbalance(
1569 /* log the changes made when moving the entries */ 1564 /* log the changes made when moving the entries */
1570 dp->d_ops->leaf_hdr_to_disk(save_leaf, &savehdr); 1565 dp->d_ops->leaf_hdr_to_disk(save_leaf, &savehdr);
1571 dp->d_ops->leaf_hdr_to_disk(drop_leaf, &drophdr); 1566 dp->d_ops->leaf_hdr_to_disk(drop_leaf, &drophdr);
1572 xfs_dir3_leaf_log_header(args->trans, dp, save_blk->bp); 1567 xfs_dir3_leaf_log_header(args, save_blk->bp);
1573 xfs_dir3_leaf_log_header(args->trans, dp, drop_blk->bp); 1568 xfs_dir3_leaf_log_header(args, drop_blk->bp);
1574 1569
1575 xfs_dir3_leaf_check(dp, save_blk->bp); 1570 xfs_dir3_leaf_check(dp, save_blk->bp);
1576 xfs_dir3_leaf_check(dp, drop_blk->bp); 1571 xfs_dir3_leaf_check(dp, drop_blk->bp);
@@ -1931,7 +1926,7 @@ xfs_dir2_node_addname_int(
1931 if (bests[findex] == cpu_to_be16(NULLDATAOFF)) { 1926 if (bests[findex] == cpu_to_be16(NULLDATAOFF)) {
1932 freehdr.nused++; 1927 freehdr.nused++;
1933 dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr); 1928 dp->d_ops->free_hdr_to_disk(fbp->b_addr, &freehdr);
1934 xfs_dir2_free_log_header(tp, dp, fbp); 1929 xfs_dir2_free_log_header(args, fbp);
1935 } 1930 }
1936 /* 1931 /*
1937 * Update the real value in the table. 1932 * Update the real value in the table.
@@ -1975,7 +1970,7 @@ xfs_dir2_node_addname_int(
1975 /* 1970 /*
1976 * Mark the first part of the unused space, inuse for us. 1971 * Mark the first part of the unused space, inuse for us.
1977 */ 1972 */
1978 xfs_dir2_data_use_free(tp, dp, dbp, dup, 1973 xfs_dir2_data_use_free(args, dbp, dup,
1979 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length, 1974 (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr), length,
1980 &needlog, &needscan); 1975 &needlog, &needscan);
1981 /* 1976 /*
@@ -1988,7 +1983,7 @@ xfs_dir2_node_addname_int(
1988 dp->d_ops->data_put_ftype(dep, args->filetype); 1983 dp->d_ops->data_put_ftype(dep, args->filetype);
1989 tagp = dp->d_ops->data_entry_tag_p(dep); 1984 tagp = dp->d_ops->data_entry_tag_p(dep);
1990 *tagp = cpu_to_be16((char *)dep - (char *)hdr); 1985 *tagp = cpu_to_be16((char *)dep - (char *)hdr);
1991 xfs_dir2_data_log_entry(tp, dp, dbp, dep); 1986 xfs_dir2_data_log_entry(args, dbp, dep);
1992 /* 1987 /*
1993 * Rescan the block for bestfree if needed. 1988 * Rescan the block for bestfree if needed.
1994 */ 1989 */
@@ -1998,7 +1993,7 @@ xfs_dir2_node_addname_int(
1998 * Log the data block header if needed. 1993 * Log the data block header if needed.
1999 */ 1994 */
2000 if (needlog) 1995 if (needlog)
2001 xfs_dir2_data_log_header(tp, dp, dbp); 1996 xfs_dir2_data_log_header(args, dbp);
2002 /* 1997 /*
2003 * If the freespace entry is now wrong, update it. 1998 * If the freespace entry is now wrong, update it.
2004 */ 1999 */
@@ -2011,7 +2006,7 @@ xfs_dir2_node_addname_int(
2011 * Log the freespace entry if needed. 2006 * Log the freespace entry if needed.
2012 */ 2007 */
2013 if (logfree) 2008 if (logfree)
2014 xfs_dir2_free_log_bests(tp, dp, fbp, findex, findex); 2009 xfs_dir2_free_log_bests(args, fbp, findex, findex);
2015 /* 2010 /*
2016 * Return the data block and offset in args, then drop the data block. 2011 * Return the data block and offset in args, then drop the data block.
2017 */ 2012 */
@@ -2208,8 +2203,7 @@ xfs_dir2_node_replace(
2208 */ 2203 */
2209 dep->inumber = cpu_to_be64(inum); 2204 dep->inumber = cpu_to_be64(inum);
2210 args->dp->d_ops->data_put_ftype(dep, args->filetype); 2205 args->dp->d_ops->data_put_ftype(dep, args->filetype);
2211 xfs_dir2_data_log_entry(args->trans, args->dp, 2206 xfs_dir2_data_log_entry(args, state->extrablk.bp, dep);
2212 state->extrablk.bp, dep);
2213 rval = 0; 2207 rval = 0;
2214 } 2208 }
2215 /* 2209 /*
diff --git a/fs/xfs/xfs_dir2_priv.h b/fs/xfs/xfs_dir2_priv.h
index 436135f28f96..27ce0794d196 100644
--- a/fs/xfs/xfs_dir2_priv.h
+++ b/fs/xfs/xfs_dir2_priv.h
@@ -211,9 +211,9 @@ extern void xfs_dir3_leaf_compact_x1(struct xfs_dir3_icleaf_hdr *leafhdr,
211 int *lowstalep, int *highstalep, int *lowlogp, int *highlogp); 211 int *lowstalep, int *highstalep, int *lowlogp, int *highlogp);
212extern int xfs_dir3_leaf_get_buf(struct xfs_da_args *args, xfs_dir2_db_t bno, 212extern int xfs_dir3_leaf_get_buf(struct xfs_da_args *args, xfs_dir2_db_t bno,
213 struct xfs_buf **bpp, __uint16_t magic); 213 struct xfs_buf **bpp, __uint16_t magic);
214extern void xfs_dir3_leaf_log_ents(struct xfs_trans *tp, struct xfs_inode *dp, 214extern void xfs_dir3_leaf_log_ents(struct xfs_da_args *args,
215 struct xfs_buf *bp, int first, int last); 215 struct xfs_buf *bp, int first, int last);
216extern void xfs_dir3_leaf_log_header(struct xfs_trans *tp, struct xfs_inode *dp, 216extern void xfs_dir3_leaf_log_header(struct xfs_da_args *args,
217 struct xfs_buf *bp); 217 struct xfs_buf *bp);
218extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args); 218extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args);
219extern int xfs_dir2_leaf_removename(struct xfs_da_args *args); 219extern int xfs_dir2_leaf_removename(struct xfs_da_args *args);