aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_data.c')
-rw-r--r--fs/xfs/xfs_dir2_data.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index 48b4906c8e80..acb61132dec4 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -110,7 +110,7 @@ xfs_dir2_data_check(
110 */ 110 */
111 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { 111 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
112 ASSERT(lastfree == 0); 112 ASSERT(lastfree == 0);
113 ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT) == 113 ASSERT(be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)) ==
114 (char *)dup - (char *)d); 114 (char *)dup - (char *)d);
115 dfp = xfs_dir2_data_freefind(d, dup); 115 dfp = xfs_dir2_data_freefind(d, dup);
116 if (dfp) { 116 if (dfp) {
@@ -366,7 +366,7 @@ xfs_dir2_data_freescan(
366 */ 366 */
367 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { 367 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
368 ASSERT((char *)dup - (char *)d == 368 ASSERT((char *)dup - (char *)d ==
369 INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); 369 be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)));
370 xfs_dir2_data_freeinsert(d, dup, loghead); 370 xfs_dir2_data_freeinsert(d, dup, loghead);
371 p += be16_to_cpu(dup->length); 371 p += be16_to_cpu(dup->length);
372 } 372 }
@@ -433,8 +433,7 @@ xfs_dir2_data_init(
433 t=mp->m_dirblksize - (uint)sizeof(d->hdr); 433 t=mp->m_dirblksize - (uint)sizeof(d->hdr);
434 d->hdr.bestfree[0].length = cpu_to_be16(t); 434 d->hdr.bestfree[0].length = cpu_to_be16(t);
435 dup->length = cpu_to_be16(t); 435 dup->length = cpu_to_be16(t);
436 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT, 436 *XFS_DIR2_DATA_UNUSED_TAG_P(dup) = cpu_to_be16((char *)dup - (char *)d);
437 (xfs_dir2_data_off_t)((char *)dup - (char *)d));
438 /* 437 /*
439 * Log it and return it. 438 * Log it and return it.
440 */ 439 */
@@ -594,8 +593,8 @@ xfs_dir2_data_make_free(
594 * Fix up the new big freespace. 593 * Fix up the new big freespace.
595 */ 594 */
596 be16_add(&prevdup->length, len + be16_to_cpu(postdup->length)); 595 be16_add(&prevdup->length, len + be16_to_cpu(postdup->length));
597 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT, 596 *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) =
598 (xfs_dir2_data_off_t)((char *)prevdup - (char *)d)); 597 cpu_to_be16((char *)prevdup - (char *)d);
599 xfs_dir2_data_log_unused(tp, bp, prevdup); 598 xfs_dir2_data_log_unused(tp, bp, prevdup);
600 if (!needscan) { 599 if (!needscan) {
601 /* 600 /*
@@ -628,8 +627,8 @@ xfs_dir2_data_make_free(
628 else if (prevdup) { 627 else if (prevdup) {
629 dfp = xfs_dir2_data_freefind(d, prevdup); 628 dfp = xfs_dir2_data_freefind(d, prevdup);
630 be16_add(&prevdup->length, len); 629 be16_add(&prevdup->length, len);
631 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT, 630 *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) =
632 (xfs_dir2_data_off_t)((char *)prevdup - (char *)d)); 631 cpu_to_be16((char *)prevdup - (char *)d);
633 xfs_dir2_data_log_unused(tp, bp, prevdup); 632 xfs_dir2_data_log_unused(tp, bp, prevdup);
634 /* 633 /*
635 * If the previous entry was in the table, the new entry 634 * If the previous entry was in the table, the new entry
@@ -656,8 +655,8 @@ xfs_dir2_data_make_free(
656 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); 655 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
657 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 656 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
658 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); 657 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
659 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, 658 *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
660 (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); 659 cpu_to_be16((char *)newdup - (char *)d);
661 xfs_dir2_data_log_unused(tp, bp, newdup); 660 xfs_dir2_data_log_unused(tp, bp, newdup);
662 /* 661 /*
663 * If the following entry was in the table, the new entry 662 * If the following entry was in the table, the new entry
@@ -683,8 +682,8 @@ xfs_dir2_data_make_free(
683 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); 682 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
684 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 683 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
685 newdup->length = cpu_to_be16(len); 684 newdup->length = cpu_to_be16(len);
686 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, 685 *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
687 (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); 686 cpu_to_be16((char *)newdup - (char *)d);
688 xfs_dir2_data_log_unused(tp, bp, newdup); 687 xfs_dir2_data_log_unused(tp, bp, newdup);
689 (void)xfs_dir2_data_freeinsert(d, newdup, needlogp); 688 (void)xfs_dir2_data_freeinsert(d, newdup, needlogp);
690 } 689 }
@@ -719,7 +718,7 @@ xfs_dir2_data_use_free(
719 ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); 718 ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG);
720 ASSERT(offset >= (char *)dup - (char *)d); 719 ASSERT(offset >= (char *)dup - (char *)d);
721 ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d); 720 ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d);
722 ASSERT((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); 721 ASSERT((char *)dup - (char *)d == be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)));
723 /* 722 /*
724 * Look up the entry in the bestfree table. 723 * Look up the entry in the bestfree table.
725 */ 724 */
@@ -752,8 +751,8 @@ xfs_dir2_data_use_free(
752 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len); 751 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
753 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 752 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
754 newdup->length = cpu_to_be16(oldlen - len); 753 newdup->length = cpu_to_be16(oldlen - len);
755 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, 754 *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
756 (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); 755 cpu_to_be16((char *)newdup - (char *)d);
757 xfs_dir2_data_log_unused(tp, bp, newdup); 756 xfs_dir2_data_log_unused(tp, bp, newdup);
758 /* 757 /*
759 * If it was in the table, remove it and add the new one. 758 * If it was in the table, remove it and add the new one.
@@ -779,8 +778,8 @@ xfs_dir2_data_use_free(
779 else if (matchback) { 778 else if (matchback) {
780 newdup = dup; 779 newdup = dup;
781 newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); 780 newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
782 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, 781 *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
783 (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); 782 cpu_to_be16((char *)newdup - (char *)d);
784 xfs_dir2_data_log_unused(tp, bp, newdup); 783 xfs_dir2_data_log_unused(tp, bp, newdup);
785 /* 784 /*
786 * If it was in the table, remove it and add the new one. 785 * If it was in the table, remove it and add the new one.
@@ -806,14 +805,14 @@ xfs_dir2_data_use_free(
806 else { 805 else {
807 newdup = dup; 806 newdup = dup;
808 newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); 807 newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
809 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT, 808 *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
810 (xfs_dir2_data_off_t)((char *)newdup - (char *)d)); 809 cpu_to_be16((char *)newdup - (char *)d);
811 xfs_dir2_data_log_unused(tp, bp, newdup); 810 xfs_dir2_data_log_unused(tp, bp, newdup);
812 newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len); 811 newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
813 newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); 812 newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
814 newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length)); 813 newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length));
815 INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup2), ARCH_CONVERT, 814 *XFS_DIR2_DATA_UNUSED_TAG_P(newdup2) =
816 (xfs_dir2_data_off_t)((char *)newdup2 - (char *)d)); 815 cpu_to_be16((char *)newdup2 - (char *)d);
817 xfs_dir2_data_log_unused(tp, bp, newdup2); 816 xfs_dir2_data_log_unused(tp, bp, newdup2);
818 /* 817 /*
819 * If the old entry was in the table, we need to scan 818 * If the old entry was in the table, we need to scan