diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_data.c')
| -rw-r--r-- | fs/xfs/xfs_dir2_data.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index c211c37ef67c..7ebe295bd6d3 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c | |||
| @@ -72,8 +72,8 @@ xfs_dir2_data_check( | |||
| 72 | bf = d->hdr.bestfree; | 72 | bf = d->hdr.bestfree; |
| 73 | p = (char *)d->u; | 73 | p = (char *)d->u; |
| 74 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { | 74 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { |
| 75 | btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); | 75 | btp = xfs_dir2_block_tail_p(mp, (xfs_dir2_block_t *)d); |
| 76 | lep = XFS_DIR2_BLOCK_LEAF_P(btp); | 76 | lep = xfs_dir2_block_leaf_p(btp); |
| 77 | endp = (char *)lep; | 77 | endp = (char *)lep; |
| 78 | } else | 78 | } else |
| 79 | endp = (char *)d + mp->m_dirblksize; | 79 | endp = (char *)d + mp->m_dirblksize; |
| @@ -107,7 +107,7 @@ xfs_dir2_data_check( | |||
| 107 | */ | 107 | */ |
| 108 | if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { | 108 | if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { |
| 109 | ASSERT(lastfree == 0); | 109 | ASSERT(lastfree == 0); |
| 110 | ASSERT(be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)) == | 110 | ASSERT(be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) == |
| 111 | (char *)dup - (char *)d); | 111 | (char *)dup - (char *)d); |
| 112 | dfp = xfs_dir2_data_freefind(d, dup); | 112 | dfp = xfs_dir2_data_freefind(d, dup); |
| 113 | if (dfp) { | 113 | if (dfp) { |
| @@ -131,12 +131,12 @@ xfs_dir2_data_check( | |||
| 131 | dep = (xfs_dir2_data_entry_t *)p; | 131 | dep = (xfs_dir2_data_entry_t *)p; |
| 132 | ASSERT(dep->namelen != 0); | 132 | ASSERT(dep->namelen != 0); |
| 133 | ASSERT(xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)) == 0); | 133 | ASSERT(xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)) == 0); |
| 134 | ASSERT(be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)) == | 134 | ASSERT(be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep)) == |
| 135 | (char *)dep - (char *)d); | 135 | (char *)dep - (char *)d); |
| 136 | count++; | 136 | count++; |
| 137 | lastfree = 0; | 137 | lastfree = 0; |
| 138 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { | 138 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { |
| 139 | addr = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk, | 139 | addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, |
| 140 | (xfs_dir2_data_aoff_t) | 140 | (xfs_dir2_data_aoff_t) |
| 141 | ((char *)dep - (char *)d)); | 141 | ((char *)dep - (char *)d)); |
| 142 | hash = xfs_da_hashname((char *)dep->name, dep->namelen); | 142 | hash = xfs_da_hashname((char *)dep->name, dep->namelen); |
| @@ -147,7 +147,7 @@ xfs_dir2_data_check( | |||
| 147 | } | 147 | } |
| 148 | ASSERT(i < be32_to_cpu(btp->count)); | 148 | ASSERT(i < be32_to_cpu(btp->count)); |
| 149 | } | 149 | } |
| 150 | p += XFS_DIR2_DATA_ENTSIZE(dep->namelen); | 150 | p += xfs_dir2_data_entsize(dep->namelen); |
| 151 | } | 151 | } |
| 152 | /* | 152 | /* |
| 153 | * Need to have seen all the entries and all the bestfree slots. | 153 | * Need to have seen all the entries and all the bestfree slots. |
| @@ -346,8 +346,8 @@ xfs_dir2_data_freescan( | |||
| 346 | */ | 346 | */ |
| 347 | p = (char *)d->u; | 347 | p = (char *)d->u; |
| 348 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { | 348 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { |
| 349 | btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); | 349 | btp = xfs_dir2_block_tail_p(mp, (xfs_dir2_block_t *)d); |
| 350 | endp = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); | 350 | endp = (char *)xfs_dir2_block_leaf_p(btp); |
| 351 | } else | 351 | } else |
| 352 | endp = (char *)d + mp->m_dirblksize; | 352 | endp = (char *)d + mp->m_dirblksize; |
| 353 | /* | 353 | /* |
| @@ -360,7 +360,7 @@ xfs_dir2_data_freescan( | |||
| 360 | */ | 360 | */ |
| 361 | if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { | 361 | if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { |
| 362 | ASSERT((char *)dup - (char *)d == | 362 | ASSERT((char *)dup - (char *)d == |
| 363 | be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup))); | 363 | be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup))); |
| 364 | xfs_dir2_data_freeinsert(d, dup, loghead); | 364 | xfs_dir2_data_freeinsert(d, dup, loghead); |
| 365 | p += be16_to_cpu(dup->length); | 365 | p += be16_to_cpu(dup->length); |
| 366 | } | 366 | } |
| @@ -370,8 +370,8 @@ xfs_dir2_data_freescan( | |||
| 370 | else { | 370 | else { |
| 371 | dep = (xfs_dir2_data_entry_t *)p; | 371 | dep = (xfs_dir2_data_entry_t *)p; |
| 372 | ASSERT((char *)dep - (char *)d == | 372 | ASSERT((char *)dep - (char *)d == |
| 373 | be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep))); | 373 | be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep))); |
| 374 | p += XFS_DIR2_DATA_ENTSIZE(dep->namelen); | 374 | p += xfs_dir2_data_entsize(dep->namelen); |
| 375 | } | 375 | } |
| 376 | } | 376 | } |
| 377 | } | 377 | } |
| @@ -402,7 +402,7 @@ xfs_dir2_data_init( | |||
| 402 | /* | 402 | /* |
| 403 | * Get the buffer set up for the block. | 403 | * Get the buffer set up for the block. |
| 404 | */ | 404 | */ |
| 405 | error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, blkno), -1, &bp, | 405 | error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, blkno), -1, &bp, |
| 406 | XFS_DATA_FORK); | 406 | XFS_DATA_FORK); |
| 407 | if (error) { | 407 | if (error) { |
| 408 | return error; | 408 | return error; |
| @@ -427,7 +427,7 @@ xfs_dir2_data_init( | |||
| 427 | t=mp->m_dirblksize - (uint)sizeof(d->hdr); | 427 | t=mp->m_dirblksize - (uint)sizeof(d->hdr); |
| 428 | d->hdr.bestfree[0].length = cpu_to_be16(t); | 428 | d->hdr.bestfree[0].length = cpu_to_be16(t); |
| 429 | dup->length = cpu_to_be16(t); | 429 | dup->length = cpu_to_be16(t); |
| 430 | *XFS_DIR2_DATA_UNUSED_TAG_P(dup) = cpu_to_be16((char *)dup - (char *)d); | 430 | *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)d); |
| 431 | /* | 431 | /* |
| 432 | * Log it and return it. | 432 | * Log it and return it. |
| 433 | */ | 433 | */ |
| @@ -452,7 +452,7 @@ xfs_dir2_data_log_entry( | |||
| 452 | ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_DATA_MAGIC || | 452 | ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_DATA_MAGIC || |
| 453 | be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC); | 453 | be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC); |
| 454 | xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)d), | 454 | xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)d), |
| 455 | (uint)((char *)(XFS_DIR2_DATA_ENTRY_TAG_P(dep) + 1) - | 455 | (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) - |
| 456 | (char *)d - 1)); | 456 | (char *)d - 1)); |
| 457 | } | 457 | } |
| 458 | 458 | ||
| @@ -497,8 +497,8 @@ xfs_dir2_data_log_unused( | |||
| 497 | * Log the end (tag) of the unused entry. | 497 | * Log the end (tag) of the unused entry. |
| 498 | */ | 498 | */ |
| 499 | xfs_da_log_buf(tp, bp, | 499 | xfs_da_log_buf(tp, bp, |
| 500 | (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d), | 500 | (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)d), |
| 501 | (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d + | 501 | (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)d + |
| 502 | sizeof(xfs_dir2_data_off_t) - 1)); | 502 | sizeof(xfs_dir2_data_off_t) - 1)); |
| 503 | } | 503 | } |
| 504 | 504 | ||
| @@ -535,8 +535,8 @@ xfs_dir2_data_make_free( | |||
| 535 | xfs_dir2_block_tail_t *btp; /* block tail */ | 535 | xfs_dir2_block_tail_t *btp; /* block tail */ |
| 536 | 536 | ||
| 537 | ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC); | 537 | ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC); |
| 538 | btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); | 538 | btp = xfs_dir2_block_tail_p(mp, (xfs_dir2_block_t *)d); |
| 539 | endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); | 539 | endptr = (char *)xfs_dir2_block_leaf_p(btp); |
| 540 | } | 540 | } |
| 541 | /* | 541 | /* |
| 542 | * If this isn't the start of the block, then back up to | 542 | * If this isn't the start of the block, then back up to |
| @@ -587,7 +587,7 @@ xfs_dir2_data_make_free( | |||
| 587 | * Fix up the new big freespace. | 587 | * Fix up the new big freespace. |
| 588 | */ | 588 | */ |
| 589 | be16_add(&prevdup->length, len + be16_to_cpu(postdup->length)); | 589 | be16_add(&prevdup->length, len + be16_to_cpu(postdup->length)); |
| 590 | *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) = | 590 | *xfs_dir2_data_unused_tag_p(prevdup) = |
| 591 | cpu_to_be16((char *)prevdup - (char *)d); | 591 | cpu_to_be16((char *)prevdup - (char *)d); |
| 592 | xfs_dir2_data_log_unused(tp, bp, prevdup); | 592 | xfs_dir2_data_log_unused(tp, bp, prevdup); |
| 593 | if (!needscan) { | 593 | if (!needscan) { |
| @@ -621,7 +621,7 @@ xfs_dir2_data_make_free( | |||
| 621 | else if (prevdup) { | 621 | else if (prevdup) { |
| 622 | dfp = xfs_dir2_data_freefind(d, prevdup); | 622 | dfp = xfs_dir2_data_freefind(d, prevdup); |
| 623 | be16_add(&prevdup->length, len); | 623 | be16_add(&prevdup->length, len); |
| 624 | *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) = | 624 | *xfs_dir2_data_unused_tag_p(prevdup) = |
| 625 | cpu_to_be16((char *)prevdup - (char *)d); | 625 | cpu_to_be16((char *)prevdup - (char *)d); |
| 626 | xfs_dir2_data_log_unused(tp, bp, prevdup); | 626 | xfs_dir2_data_log_unused(tp, bp, prevdup); |
| 627 | /* | 627 | /* |
| @@ -649,7 +649,7 @@ xfs_dir2_data_make_free( | |||
| 649 | newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); | 649 | newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); |
| 650 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 650 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
| 651 | newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); | 651 | newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length)); |
| 652 | *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) = | 652 | *xfs_dir2_data_unused_tag_p(newdup) = |
| 653 | cpu_to_be16((char *)newdup - (char *)d); | 653 | cpu_to_be16((char *)newdup - (char *)d); |
| 654 | xfs_dir2_data_log_unused(tp, bp, newdup); | 654 | xfs_dir2_data_log_unused(tp, bp, newdup); |
| 655 | /* | 655 | /* |
| @@ -676,7 +676,7 @@ xfs_dir2_data_make_free( | |||
| 676 | newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); | 676 | newdup = (xfs_dir2_data_unused_t *)((char *)d + offset); |
| 677 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 677 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
| 678 | newdup->length = cpu_to_be16(len); | 678 | newdup->length = cpu_to_be16(len); |
| 679 | *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) = | 679 | *xfs_dir2_data_unused_tag_p(newdup) = |
| 680 | cpu_to_be16((char *)newdup - (char *)d); | 680 | cpu_to_be16((char *)newdup - (char *)d); |
| 681 | xfs_dir2_data_log_unused(tp, bp, newdup); | 681 | xfs_dir2_data_log_unused(tp, bp, newdup); |
| 682 | (void)xfs_dir2_data_freeinsert(d, newdup, needlogp); | 682 | (void)xfs_dir2_data_freeinsert(d, newdup, needlogp); |
| @@ -712,7 +712,7 @@ xfs_dir2_data_use_free( | |||
| 712 | ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); | 712 | ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); |
| 713 | ASSERT(offset >= (char *)dup - (char *)d); | 713 | ASSERT(offset >= (char *)dup - (char *)d); |
| 714 | ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d); | 714 | ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d); |
| 715 | ASSERT((char *)dup - (char *)d == be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup))); | 715 | ASSERT((char *)dup - (char *)d == be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup))); |
| 716 | /* | 716 | /* |
| 717 | * Look up the entry in the bestfree table. | 717 | * Look up the entry in the bestfree table. |
| 718 | */ | 718 | */ |
| @@ -745,7 +745,7 @@ xfs_dir2_data_use_free( | |||
| 745 | newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len); | 745 | newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len); |
| 746 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 746 | newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
| 747 | newdup->length = cpu_to_be16(oldlen - len); | 747 | newdup->length = cpu_to_be16(oldlen - len); |
| 748 | *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) = | 748 | *xfs_dir2_data_unused_tag_p(newdup) = |
| 749 | cpu_to_be16((char *)newdup - (char *)d); | 749 | cpu_to_be16((char *)newdup - (char *)d); |
| 750 | xfs_dir2_data_log_unused(tp, bp, newdup); | 750 | xfs_dir2_data_log_unused(tp, bp, newdup); |
| 751 | /* | 751 | /* |
| @@ -772,7 +772,7 @@ xfs_dir2_data_use_free( | |||
| 772 | else if (matchback) { | 772 | else if (matchback) { |
| 773 | newdup = dup; | 773 | newdup = dup; |
| 774 | newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); | 774 | newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); |
| 775 | *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) = | 775 | *xfs_dir2_data_unused_tag_p(newdup) = |
| 776 | cpu_to_be16((char *)newdup - (char *)d); | 776 | cpu_to_be16((char *)newdup - (char *)d); |
| 777 | xfs_dir2_data_log_unused(tp, bp, newdup); | 777 | xfs_dir2_data_log_unused(tp, bp, newdup); |
| 778 | /* | 778 | /* |
| @@ -799,13 +799,13 @@ xfs_dir2_data_use_free( | |||
| 799 | else { | 799 | else { |
| 800 | newdup = dup; | 800 | newdup = dup; |
| 801 | newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); | 801 | newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup); |
| 802 | *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) = | 802 | *xfs_dir2_data_unused_tag_p(newdup) = |
| 803 | cpu_to_be16((char *)newdup - (char *)d); | 803 | cpu_to_be16((char *)newdup - (char *)d); |
| 804 | xfs_dir2_data_log_unused(tp, bp, newdup); | 804 | xfs_dir2_data_log_unused(tp, bp, newdup); |
| 805 | newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len); | 805 | newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len); |
| 806 | newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); | 806 | newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG); |
| 807 | newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length)); | 807 | newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length)); |
| 808 | *XFS_DIR2_DATA_UNUSED_TAG_P(newdup2) = | 808 | *xfs_dir2_data_unused_tag_p(newdup2) = |
| 809 | cpu_to_be16((char *)newdup2 - (char *)d); | 809 | cpu_to_be16((char *)newdup2 - (char *)d); |
| 810 | xfs_dir2_data_log_unused(tp, bp, newdup2); | 810 | xfs_dir2_data_log_unused(tp, bp, newdup2); |
| 811 | /* | 811 | /* |
