aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_data.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-10-29 07:11:49 -0400
committerBen Myers <bpm@sgi.com>2013-10-30 14:39:31 -0400
commit2ca9877410594dd321621efc9e1cbcd1ca24d0f3 (patch)
tree002e968ea70087df002ecc70d0966868c49b0cd1 /fs/xfs/xfs_dir2_data.c
parent9d23fc8575de7012b8853bd6fefe10534665de2f (diff)
xfs: vectorise directory data operations part 2
Convert the rest of the directory data block encode/decode operations to vector format. This further reduces the size of the built binary: text data bss dec hex filename 794490 96802 1096 892388 d9de4 fs/xfs/xfs.o.orig 792986 96802 1096 890884 d9804 fs/xfs/xfs.o.p1 792350 96802 1096 890248 d9588 fs/xfs/xfs.o.p2 789293 96802 1096 887191 d8997 fs/xfs/xfs.o.p3 789005 96802 1096 886903 d8997 fs/xfs/xfs.o.p4 Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_data.c')
-rw-r--r--fs/xfs/xfs_dir2_data.c106
1 files changed, 57 insertions, 49 deletions
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index 00006b3db054..13fa0d6b4ff7 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -66,8 +66,6 @@ __xfs_dir3_data_check(
66 66
67 mp = bp->b_target->bt_mount; 67 mp = bp->b_target->bt_mount;
68 hdr = bp->b_addr; 68 hdr = bp->b_addr;
69 bf = xfs_dir3_data_bestfree_p(hdr);
70 p = (char *)xfs_dir3_data_entry_p(hdr);
71 69
72 /* 70 /*
73 * We can be passed a null dp here from a verifier, so manually 71 * We can be passed a null dp here from a verifier, so manually
@@ -97,6 +95,8 @@ __xfs_dir3_data_check(
97 XFS_ERROR_REPORT("Bad Magic", XFS_ERRLEVEL_LOW, mp); 95 XFS_ERROR_REPORT("Bad Magic", XFS_ERRLEVEL_LOW, mp);
98 return EFSCORRUPTED; 96 return EFSCORRUPTED;
99 } 97 }
98 bf = ops->data_bestfree_p(hdr);
99 p = (char *)ops->data_entry_p(hdr);
100 100
101 count = lastfree = freeseen = 0; 101 count = lastfree = freeseen = 0;
102 /* 102 /*
@@ -134,7 +134,7 @@ __xfs_dir3_data_check(
134 XFS_WANT_CORRUPTED_RETURN( 134 XFS_WANT_CORRUPTED_RETURN(
135 be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) == 135 be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) ==
136 (char *)dup - (char *)hdr); 136 (char *)dup - (char *)hdr);
137 dfp = xfs_dir2_data_freefind(hdr, dup); 137 dfp = xfs_dir2_data_freefind(hdr, bf, dup);
138 if (dfp) { 138 if (dfp) {
139 i = (int)(dfp - bf); 139 i = (int)(dfp - bf);
140 XFS_WANT_CORRUPTED_RETURN( 140 XFS_WANT_CORRUPTED_RETURN(
@@ -340,19 +340,18 @@ xfs_dir3_data_readahead(
340 */ 340 */
341xfs_dir2_data_free_t * 341xfs_dir2_data_free_t *
342xfs_dir2_data_freefind( 342xfs_dir2_data_freefind(
343 xfs_dir2_data_hdr_t *hdr, /* data block */ 343 struct xfs_dir2_data_hdr *hdr, /* data block header */
344 xfs_dir2_data_unused_t *dup) /* data unused entry */ 344 struct xfs_dir2_data_free *bf, /* bestfree table pointer */
345 struct xfs_dir2_data_unused *dup) /* unused space */
345{ 346{
346 xfs_dir2_data_free_t *dfp; /* bestfree entry */ 347 xfs_dir2_data_free_t *dfp; /* bestfree entry */
347 xfs_dir2_data_aoff_t off; /* offset value needed */ 348 xfs_dir2_data_aoff_t off; /* offset value needed */
348 struct xfs_dir2_data_free *bf;
349#ifdef DEBUG 349#ifdef DEBUG
350 int matched; /* matched the value */ 350 int matched; /* matched the value */
351 int seenzero; /* saw a 0 bestfree entry */ 351 int seenzero; /* saw a 0 bestfree entry */
352#endif 352#endif
353 353
354 off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); 354 off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr);
355 bf = xfs_dir3_data_bestfree_p(hdr);
356 355
357#ifdef DEBUG 356#ifdef DEBUG
358 /* 357 /*
@@ -412,11 +411,11 @@ xfs_dir2_data_freefind(
412 */ 411 */
413xfs_dir2_data_free_t * /* entry inserted */ 412xfs_dir2_data_free_t * /* entry inserted */
414xfs_dir2_data_freeinsert( 413xfs_dir2_data_freeinsert(
415 xfs_dir2_data_hdr_t *hdr, /* data block pointer */ 414 struct xfs_dir2_data_hdr *hdr, /* data block pointer */
416 xfs_dir2_data_unused_t *dup, /* unused space */ 415 struct xfs_dir2_data_free *dfp, /* bestfree table pointer */
416 struct xfs_dir2_data_unused *dup, /* unused space */
417 int *loghead) /* log the data header (out) */ 417 int *loghead) /* log the data header (out) */
418{ 418{
419 xfs_dir2_data_free_t *dfp; /* bestfree table pointer */
420 xfs_dir2_data_free_t new; /* new bestfree entry */ 419 xfs_dir2_data_free_t new; /* new bestfree entry */
421 420
422 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || 421 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
@@ -424,7 +423,6 @@ xfs_dir2_data_freeinsert(
424 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || 423 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
425 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 424 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
426 425
427 dfp = xfs_dir3_data_bestfree_p(hdr);
428 new.length = dup->length; 426 new.length = dup->length;
429 new.offset = cpu_to_be16((char *)dup - (char *)hdr); 427 new.offset = cpu_to_be16((char *)dup - (char *)hdr);
430 428
@@ -457,11 +455,11 @@ xfs_dir2_data_freeinsert(
457 */ 455 */
458STATIC void 456STATIC void
459xfs_dir2_data_freeremove( 457xfs_dir2_data_freeremove(
460 xfs_dir2_data_hdr_t *hdr, /* data block header */ 458 struct xfs_dir2_data_hdr *hdr, /* data block header */
461 xfs_dir2_data_free_t *dfp, /* bestfree entry pointer */ 459 struct xfs_dir2_data_free *bf, /* bestfree table pointer */
460 struct xfs_dir2_data_free *dfp, /* bestfree entry pointer */
462 int *loghead) /* out: log data header */ 461 int *loghead) /* out: log data header */
463{ 462{
464 struct xfs_dir2_data_free *bf;
465 463
466 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || 464 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
467 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 465 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
@@ -471,7 +469,6 @@ xfs_dir2_data_freeremove(
471 /* 469 /*
472 * It's the first entry, slide the next 2 up. 470 * It's the first entry, slide the next 2 up.
473 */ 471 */
474 bf = xfs_dir3_data_bestfree_p(hdr);
475 if (dfp == &bf[0]) { 472 if (dfp == &bf[0]) {
476 bf[0] = bf[1]; 473 bf[0] = bf[1];
477 bf[1] = bf[2]; 474 bf[1] = bf[2];
@@ -518,13 +515,13 @@ xfs_dir2_data_freescan(
518 /* 515 /*
519 * Start by clearing the table. 516 * Start by clearing the table.
520 */ 517 */
521 bf = xfs_dir3_data_bestfree_p(hdr); 518 bf = dp->d_ops->data_bestfree_p(hdr);
522 memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT); 519 memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT);
523 *loghead = 1; 520 *loghead = 1;
524 /* 521 /*
525 * Set up pointers. 522 * Set up pointers.
526 */ 523 */
527 p = (char *)xfs_dir3_data_entry_p(hdr); 524 p = (char *)dp->d_ops->data_entry_p(hdr);
528 if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 525 if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
529 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { 526 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) {
530 btp = xfs_dir2_block_tail_p(dp->i_mount, hdr); 527 btp = xfs_dir2_block_tail_p(dp->i_mount, hdr);
@@ -542,7 +539,7 @@ xfs_dir2_data_freescan(
542 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { 539 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
543 ASSERT((char *)dup - (char *)hdr == 540 ASSERT((char *)dup - (char *)hdr ==
544 be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup))); 541 be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)));
545 xfs_dir2_data_freeinsert(hdr, dup, loghead); 542 xfs_dir2_data_freeinsert(hdr, bf, dup, loghead);
546 p += be16_to_cpu(dup->length); 543 p += be16_to_cpu(dup->length);
547 } 544 }
548 /* 545 /*
@@ -607,8 +604,8 @@ xfs_dir3_data_init(
607 } else 604 } else
608 hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); 605 hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
609 606
610 bf = xfs_dir3_data_bestfree_p(hdr); 607 bf = dp->d_ops->data_bestfree_p(hdr);
611 bf[0].offset = cpu_to_be16(xfs_dir3_data_entry_offset(hdr)); 608 bf[0].offset = cpu_to_be16(dp->d_ops->data_entry_offset());
612 for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { 609 for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
613 bf[i].length = 0; 610 bf[i].length = 0;
614 bf[i].offset = 0; 611 bf[i].offset = 0;
@@ -617,17 +614,17 @@ xfs_dir3_data_init(
617 /* 614 /*
618 * Set up an unused entry for the block's body. 615 * Set up an unused entry for the block's body.
619 */ 616 */
620 dup = xfs_dir3_data_unused_p(hdr); 617 dup = dp->d_ops->data_unused_p(hdr);
621 dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 618 dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
622 619
623 t = mp->m_dirblksize - (uint)xfs_dir3_data_entry_offset(hdr); 620 t = mp->m_dirblksize - (uint)dp->d_ops->data_entry_offset();
624 bf[0].length = cpu_to_be16(t); 621 bf[0].length = cpu_to_be16(t);
625 dup->length = cpu_to_be16(t); 622 dup->length = cpu_to_be16(t);
626 *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr); 623 *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)hdr);
627 /* 624 /*
628 * Log it and return it. 625 * Log it and return it.
629 */ 626 */
630 xfs_dir2_data_log_header(tp, bp); 627 xfs_dir2_data_log_header(tp, dp, bp);
631 xfs_dir2_data_log_unused(tp, bp, dup); 628 xfs_dir2_data_log_unused(tp, bp, dup);
632 *bpp = bp; 629 *bpp = bp;
633 return 0; 630 return 0;
@@ -661,16 +658,19 @@ xfs_dir2_data_log_entry(
661void 658void
662xfs_dir2_data_log_header( 659xfs_dir2_data_log_header(
663 struct xfs_trans *tp, 660 struct xfs_trans *tp,
661 struct xfs_inode *dp,
664 struct xfs_buf *bp) 662 struct xfs_buf *bp)
665{ 663{
666 xfs_dir2_data_hdr_t *hdr = bp->b_addr; 664#ifdef DEBUG
665 struct xfs_dir2_data_hdr *hdr = bp->b_addr;
667 666
668 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || 667 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
669 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || 668 hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
670 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 669 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
671 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 670 hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC));
671#endif
672 672
673 xfs_trans_log_buf(tp, bp, 0, xfs_dir3_data_entry_offset(hdr) - 1); 673 xfs_trans_log_buf(tp, bp, 0, dp->d_ops->data_entry_offset() - 1);
674} 674}
675 675
676/* 676/*
@@ -711,6 +711,7 @@ xfs_dir2_data_log_unused(
711void 711void
712xfs_dir2_data_make_free( 712xfs_dir2_data_make_free(
713 struct xfs_trans *tp, 713 struct xfs_trans *tp,
714 struct xfs_inode *dp,
714 struct xfs_buf *bp, 715 struct xfs_buf *bp,
715 xfs_dir2_data_aoff_t offset, /* starting byte offset */ 716 xfs_dir2_data_aoff_t offset, /* starting byte offset */
716 xfs_dir2_data_aoff_t len, /* length in bytes */ 717 xfs_dir2_data_aoff_t len, /* length in bytes */
@@ -748,7 +749,7 @@ xfs_dir2_data_make_free(
748 * If this isn't the start of the block, then back up to 749 * If this isn't the start of the block, then back up to
749 * the previous entry and see if it's free. 750 * the previous entry and see if it's free.
750 */ 751 */
751 if (offset > xfs_dir3_data_entry_offset(hdr)) { 752 if (offset > dp->d_ops->data_entry_offset()) {
752 __be16 *tagp; /* tag just before us */ 753 __be16 *tagp; /* tag just before us */
753 754
754 tagp = (__be16 *)((char *)hdr + offset) - 1; 755 tagp = (__be16 *)((char *)hdr + offset) - 1;
@@ -774,15 +775,15 @@ xfs_dir2_data_make_free(
774 * Previous and following entries are both free, 775 * Previous and following entries are both free,
775 * merge everything into a single free entry. 776 * merge everything into a single free entry.
776 */ 777 */
777 bf = xfs_dir3_data_bestfree_p(hdr); 778 bf = dp->d_ops->data_bestfree_p(hdr);
778 if (prevdup && postdup) { 779 if (prevdup && postdup) {
779 xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */ 780 xfs_dir2_data_free_t *dfp2; /* another bestfree pointer */
780 781
781 /* 782 /*
782 * See if prevdup and/or postdup are in bestfree table. 783 * See if prevdup and/or postdup are in bestfree table.
783 */ 784 */
784 dfp = xfs_dir2_data_freefind(hdr, prevdup); 785 dfp = xfs_dir2_data_freefind(hdr, bf, prevdup);
785 dfp2 = xfs_dir2_data_freefind(hdr, postdup); 786 dfp2 = xfs_dir2_data_freefind(hdr, bf, postdup);
786 /* 787 /*
787 * We need a rescan unless there are exactly 2 free entries 788 * We need a rescan unless there are exactly 2 free entries
788 * namely our two. Then we know what's happening, otherwise 789 * namely our two. Then we know what's happening, otherwise
@@ -810,12 +811,13 @@ xfs_dir2_data_make_free(
810 ASSERT(dfp2 == dfp); 811 ASSERT(dfp2 == dfp);
811 dfp2 = &bf[1]; 812 dfp2 = &bf[1];
812 } 813 }
813 xfs_dir2_data_freeremove(hdr, dfp2, needlogp); 814 xfs_dir2_data_freeremove(hdr, bf, dfp2, needlogp);
814 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 815 xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp);
815 /* 816 /*
816 * Now insert the new entry. 817 * Now insert the new entry.
817 */ 818 */
818 dfp = xfs_dir2_data_freeinsert(hdr, prevdup, needlogp); 819 dfp = xfs_dir2_data_freeinsert(hdr, bf, prevdup,
820 needlogp);
819 ASSERT(dfp == &bf[0]); 821 ASSERT(dfp == &bf[0]);
820 ASSERT(dfp->length == prevdup->length); 822 ASSERT(dfp->length == prevdup->length);
821 ASSERT(!dfp[1].length); 823 ASSERT(!dfp[1].length);
@@ -826,7 +828,7 @@ xfs_dir2_data_make_free(
826 * The entry before us is free, merge with it. 828 * The entry before us is free, merge with it.
827 */ 829 */
828 else if (prevdup) { 830 else if (prevdup) {
829 dfp = xfs_dir2_data_freefind(hdr, prevdup); 831 dfp = xfs_dir2_data_freefind(hdr, bf, prevdup);
830 be16_add_cpu(&prevdup->length, len); 832 be16_add_cpu(&prevdup->length, len);
831 *xfs_dir2_data_unused_tag_p(prevdup) = 833 *xfs_dir2_data_unused_tag_p(prevdup) =
832 cpu_to_be16((char *)prevdup - (char *)hdr); 834 cpu_to_be16((char *)prevdup - (char *)hdr);
@@ -837,8 +839,8 @@ xfs_dir2_data_make_free(
837 * the old one and add the new one. 839 * the old one and add the new one.
838 */ 840 */
839 if (dfp) { 841 if (dfp) {
840 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 842 xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp);
841 xfs_dir2_data_freeinsert(hdr, prevdup, needlogp); 843 xfs_dir2_data_freeinsert(hdr, bf, prevdup, needlogp);
842 } 844 }
843 /* 845 /*
844 * Otherwise we need a scan if the new entry is big enough. 846 * Otherwise we need a scan if the new entry is big enough.
@@ -852,7 +854,7 @@ xfs_dir2_data_make_free(
852 * The following entry is free, merge with it. 854 * The following entry is free, merge with it.
853 */ 855 */
854 else if (postdup) { 856 else if (postdup) {
855 dfp = xfs_dir2_data_freefind(hdr, postdup); 857 dfp = xfs_dir2_data_freefind(hdr, bf, postdup);
856 newdup = (xfs_dir2_data_unused_t *)((char *)hdr + offset); 858 newdup = (xfs_dir2_data_unused_t *)((char *)hdr + offset);
857 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 859 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
858 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); 860 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
@@ -865,8 +867,8 @@ xfs_dir2_data_make_free(
865 * the old one and add the new one. 867 * the old one and add the new one.
866 */ 868 */
867 if (dfp) { 869 if (dfp) {
868 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 870 xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp);
869 xfs_dir2_data_freeinsert(hdr, newdup, needlogp); 871 xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp);
870 } 872 }
871 /* 873 /*
872 * Otherwise we need a scan if the new entry is big enough. 874 * Otherwise we need a scan if the new entry is big enough.
@@ -886,7 +888,7 @@ xfs_dir2_data_make_free(
886 *xfs_dir2_data_unused_tag_p(newdup) = 888 *xfs_dir2_data_unused_tag_p(newdup) =
887 cpu_to_be16((char *)newdup - (char *)hdr); 889 cpu_to_be16((char *)newdup - (char *)hdr);
888 xfs_dir2_data_log_unused(tp, bp, newdup); 890 xfs_dir2_data_log_unused(tp, bp, newdup);
889 xfs_dir2_data_freeinsert(hdr, newdup, needlogp); 891 xfs_dir2_data_freeinsert(hdr, bf, newdup, needlogp);
890 } 892 }
891 *needscanp = needscan; 893 *needscanp = needscan;
892} 894}
@@ -897,6 +899,7 @@ xfs_dir2_data_make_free(
897void 899void
898xfs_dir2_data_use_free( 900xfs_dir2_data_use_free(
899 struct xfs_trans *tp, 901 struct xfs_trans *tp,
902 struct xfs_inode *dp,
900 struct xfs_buf *bp, 903 struct xfs_buf *bp,
901 xfs_dir2_data_unused_t *dup, /* unused entry */ 904 xfs_dir2_data_unused_t *dup, /* unused entry */
902 xfs_dir2_data_aoff_t offset, /* starting offset to use */ 905 xfs_dir2_data_aoff_t offset, /* starting offset to use */
@@ -926,9 +929,9 @@ xfs_dir2_data_use_free(
926 /* 929 /*
927 * Look up the entry in the bestfree table. 930 * Look up the entry in the bestfree table.
928 */ 931 */
929 dfp = xfs_dir2_data_freefind(hdr, dup);
930 oldlen = be16_to_cpu(dup->length); 932 oldlen = be16_to_cpu(dup->length);
931 bf = xfs_dir3_data_bestfree_p(hdr); 933 bf = dp->d_ops->data_bestfree_p(hdr);
934 dfp = xfs_dir2_data_freefind(hdr, bf, dup);
932 ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length)); 935 ASSERT(dfp || oldlen <= be16_to_cpu(bf[2].length));
933 /* 936 /*
934 * Check for alignment with front and back of the entry. 937 * Check for alignment with front and back of the entry.
@@ -945,7 +948,8 @@ xfs_dir2_data_use_free(
945 if (dfp) { 948 if (dfp) {
946 needscan = (bf[2].offset != 0); 949 needscan = (bf[2].offset != 0);
947 if (!needscan) 950 if (!needscan)
948 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 951 xfs_dir2_data_freeremove(hdr, bf, dfp,
952 needlogp);
949 } 953 }
950 } 954 }
951 /* 955 /*
@@ -963,8 +967,9 @@ xfs_dir2_data_use_free(
963 * If it was in the table, remove it and add the new one. 967 * If it was in the table, remove it and add the new one.
964 */ 968 */
965 if (dfp) { 969 if (dfp) {
966 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 970 xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp);
967 dfp = xfs_dir2_data_freeinsert(hdr, newdup, needlogp); 971 dfp = xfs_dir2_data_freeinsert(hdr, bf, newdup,
972 needlogp);
968 ASSERT(dfp != NULL); 973 ASSERT(dfp != NULL);
969 ASSERT(dfp->length == newdup->length); 974 ASSERT(dfp->length == newdup->length);
970 ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr); 975 ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr);
@@ -990,8 +995,9 @@ xfs_dir2_data_use_free(
990 * If it was in the table, remove it and add the new one. 995 * If it was in the table, remove it and add the new one.
991 */ 996 */
992 if (dfp) { 997 if (dfp) {
993 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 998 xfs_dir2_data_freeremove(hdr, bf, dfp, needlogp);
994 dfp = xfs_dir2_data_freeinsert(hdr, newdup, needlogp); 999 dfp = xfs_dir2_data_freeinsert(hdr, bf, newdup,
1000 needlogp);
995 ASSERT(dfp != NULL); 1001 ASSERT(dfp != NULL);
996 ASSERT(dfp->length == newdup->length); 1002 ASSERT(dfp->length == newdup->length);
997 ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr); 1003 ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)hdr);
@@ -1030,9 +1036,11 @@ xfs_dir2_data_use_free(
1030 if (dfp) { 1036 if (dfp) {
1031 needscan = (bf[2].length != 0); 1037 needscan = (bf[2].length != 0);
1032 if (!needscan) { 1038 if (!needscan) {
1033 xfs_dir2_data_freeremove(hdr, dfp, needlogp); 1039 xfs_dir2_data_freeremove(hdr, bf, dfp,
1034 xfs_dir2_data_freeinsert(hdr, newdup, needlogp); 1040 needlogp);
1035 xfs_dir2_data_freeinsert(hdr, newdup2, 1041 xfs_dir2_data_freeinsert(hdr, bf, newdup,
1042 needlogp);
1043 xfs_dir2_data_freeinsert(hdr, bf, newdup2,
1036 needlogp); 1044 needlogp);
1037 } 1045 }
1038 } 1046 }