diff options
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_block.c | 52 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_data.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 55 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 57 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_sf.c | 2 |
7 files changed, 93 insertions, 87 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index c443cbaaaa92..31796c7faba0 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -1798,7 +1798,7 @@ xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop, | |||
1798 | ASSERT(XFS_DIR_IS_V2(mp)); | 1798 | ASSERT(XFS_DIR_IS_V2(mp)); |
1799 | dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; | 1799 | dead_leaf2 = (xfs_dir2_leaf_t *)dead_info; |
1800 | dead_level = 0; | 1800 | dead_level = 0; |
1801 | dead_hash = INT_GET(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval, ARCH_CONVERT); | 1801 | dead_hash = be32_to_cpu(dead_leaf2->ents[be16_to_cpu(dead_leaf2->hdr.count) - 1].hashval); |
1802 | } else { | 1802 | } else { |
1803 | ASSERT(INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); | 1803 | ASSERT(INT_GET(dead_info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); |
1804 | dead_node = (xfs_da_intnode_t *)dead_info; | 1804 | dead_node = (xfs_da_intnode_t *)dead_info; |
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c index 1dd1a7694e4b..fa372b2b433d 100644 --- a/fs/xfs/xfs_dir2_block.c +++ b/fs/xfs/xfs_dir2_block.c | |||
@@ -246,7 +246,7 @@ xfs_dir2_block_addname( | |||
246 | highstale = lfloghigh = -1; | 246 | highstale = lfloghigh = -1; |
247 | fromidx >= 0; | 247 | fromidx >= 0; |
248 | fromidx--) { | 248 | fromidx--) { |
249 | if (INT_GET(blp[fromidx].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) { | 249 | if (be32_to_cpu(blp[fromidx].address) == XFS_DIR2_NULL_DATAPTR) { |
250 | if (highstale == -1) | 250 | if (highstale == -1) |
251 | highstale = toidx; | 251 | highstale = toidx; |
252 | else { | 252 | else { |
@@ -291,14 +291,14 @@ xfs_dir2_block_addname( | |||
291 | */ | 291 | */ |
292 | for (low = 0, high = be32_to_cpu(btp->count) - 1; low <= high; ) { | 292 | for (low = 0, high = be32_to_cpu(btp->count) - 1; low <= high; ) { |
293 | mid = (low + high) >> 1; | 293 | mid = (low + high) >> 1; |
294 | if ((hash = INT_GET(blp[mid].hashval, ARCH_CONVERT)) == args->hashval) | 294 | if ((hash = be32_to_cpu(blp[mid].hashval)) == args->hashval) |
295 | break; | 295 | break; |
296 | if (hash < args->hashval) | 296 | if (hash < args->hashval) |
297 | low = mid + 1; | 297 | low = mid + 1; |
298 | else | 298 | else |
299 | high = mid - 1; | 299 | high = mid - 1; |
300 | } | 300 | } |
301 | while (mid >= 0 && INT_GET(blp[mid].hashval, ARCH_CONVERT) >= args->hashval) { | 301 | while (mid >= 0 && be32_to_cpu(blp[mid].hashval) >= args->hashval) { |
302 | mid--; | 302 | mid--; |
303 | } | 303 | } |
304 | /* | 304 | /* |
@@ -345,12 +345,12 @@ xfs_dir2_block_addname( | |||
345 | else { | 345 | else { |
346 | for (lowstale = mid; | 346 | for (lowstale = mid; |
347 | lowstale >= 0 && | 347 | lowstale >= 0 && |
348 | INT_GET(blp[lowstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR; | 348 | be32_to_cpu(blp[lowstale].address) != XFS_DIR2_NULL_DATAPTR; |
349 | lowstale--) | 349 | lowstale--) |
350 | continue; | 350 | continue; |
351 | for (highstale = mid + 1; | 351 | for (highstale = mid + 1; |
352 | highstale < be32_to_cpu(btp->count) && | 352 | highstale < be32_to_cpu(btp->count) && |
353 | INT_GET(blp[highstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR && | 353 | be32_to_cpu(blp[highstale].address) != XFS_DIR2_NULL_DATAPTR && |
354 | (lowstale < 0 || mid - lowstale > highstale - mid); | 354 | (lowstale < 0 || mid - lowstale > highstale - mid); |
355 | highstale++) | 355 | highstale++) |
356 | continue; | 356 | continue; |
@@ -387,8 +387,9 @@ xfs_dir2_block_addname( | |||
387 | /* | 387 | /* |
388 | * Fill in the leaf entry. | 388 | * Fill in the leaf entry. |
389 | */ | 389 | */ |
390 | INT_SET(blp[mid].hashval, ARCH_CONVERT, args->hashval); | 390 | blp[mid].hashval = cpu_to_be32(args->hashval); |
391 | INT_SET(blp[mid].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)dep - (char *)block)); | 391 | blp[mid].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, |
392 | (char *)dep - (char *)block)); | ||
392 | xfs_dir2_block_log_leaf(tp, bp, lfloglow, lfloghigh); | 393 | xfs_dir2_block_log_leaf(tp, bp, lfloglow, lfloghigh); |
393 | /* | 394 | /* |
394 | * Mark space for the data entry used. | 395 | * Mark space for the data entry used. |
@@ -621,7 +622,7 @@ xfs_dir2_block_lookup( | |||
621 | * Get the offset from the leaf entry, to point to the data. | 622 | * Get the offset from the leaf entry, to point to the data. |
622 | */ | 623 | */ |
623 | dep = (xfs_dir2_data_entry_t *) | 624 | dep = (xfs_dir2_data_entry_t *) |
624 | ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(blp[ent].address, ARCH_CONVERT))); | 625 | ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address))); |
625 | /* | 626 | /* |
626 | * Fill in inode number, release the block. | 627 | * Fill in inode number, release the block. |
627 | */ | 628 | */ |
@@ -676,7 +677,7 @@ xfs_dir2_block_lookup_int( | |||
676 | for (low = 0, high = be32_to_cpu(btp->count) - 1; ; ) { | 677 | for (low = 0, high = be32_to_cpu(btp->count) - 1; ; ) { |
677 | ASSERT(low <= high); | 678 | ASSERT(low <= high); |
678 | mid = (low + high) >> 1; | 679 | mid = (low + high) >> 1; |
679 | if ((hash = INT_GET(blp[mid].hashval, ARCH_CONVERT)) == args->hashval) | 680 | if ((hash = be32_to_cpu(blp[mid].hashval)) == args->hashval) |
680 | break; | 681 | break; |
681 | if (hash < args->hashval) | 682 | if (hash < args->hashval) |
682 | low = mid + 1; | 683 | low = mid + 1; |
@@ -691,7 +692,7 @@ xfs_dir2_block_lookup_int( | |||
691 | /* | 692 | /* |
692 | * Back up to the first one with the right hash value. | 693 | * Back up to the first one with the right hash value. |
693 | */ | 694 | */ |
694 | while (mid > 0 && INT_GET(blp[mid - 1].hashval, ARCH_CONVERT) == args->hashval) { | 695 | while (mid > 0 && be32_to_cpu(blp[mid - 1].hashval) == args->hashval) { |
695 | mid--; | 696 | mid--; |
696 | } | 697 | } |
697 | /* | 698 | /* |
@@ -699,7 +700,7 @@ xfs_dir2_block_lookup_int( | |||
699 | * right hash value looking for our name. | 700 | * right hash value looking for our name. |
700 | */ | 701 | */ |
701 | do { | 702 | do { |
702 | if ((addr = INT_GET(blp[mid].address, ARCH_CONVERT)) == XFS_DIR2_NULL_DATAPTR) | 703 | if ((addr = be32_to_cpu(blp[mid].address)) == XFS_DIR2_NULL_DATAPTR) |
703 | continue; | 704 | continue; |
704 | /* | 705 | /* |
705 | * Get pointer to the entry from the leaf. | 706 | * Get pointer to the entry from the leaf. |
@@ -716,7 +717,7 @@ xfs_dir2_block_lookup_int( | |||
716 | *entno = mid; | 717 | *entno = mid; |
717 | return 0; | 718 | return 0; |
718 | } | 719 | } |
719 | } while (++mid < be32_to_cpu(btp->count) && INT_GET(blp[mid].hashval, ARCH_CONVERT) == hash); | 720 | } while (++mid < be32_to_cpu(btp->count) && be32_to_cpu(blp[mid].hashval) == hash); |
720 | /* | 721 | /* |
721 | * No match, release the buffer and return ENOENT. | 722 | * No match, release the buffer and return ENOENT. |
722 | */ | 723 | */ |
@@ -766,7 +767,7 @@ xfs_dir2_block_removename( | |||
766 | * Point to the data entry using the leaf entry. | 767 | * Point to the data entry using the leaf entry. |
767 | */ | 768 | */ |
768 | dep = (xfs_dir2_data_entry_t *) | 769 | dep = (xfs_dir2_data_entry_t *) |
769 | ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(blp[ent].address, ARCH_CONVERT))); | 770 | ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address))); |
770 | /* | 771 | /* |
771 | * Mark the data entry's space free. | 772 | * Mark the data entry's space free. |
772 | */ | 773 | */ |
@@ -782,7 +783,7 @@ xfs_dir2_block_removename( | |||
782 | /* | 783 | /* |
783 | * Remove the leaf entry by marking it stale. | 784 | * Remove the leaf entry by marking it stale. |
784 | */ | 785 | */ |
785 | INT_SET(blp[ent].address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); | 786 | blp[ent].address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); |
786 | xfs_dir2_block_log_leaf(tp, bp, ent, ent); | 787 | xfs_dir2_block_log_leaf(tp, bp, ent, ent); |
787 | /* | 788 | /* |
788 | * Fix up bestfree, log the header if necessary. | 789 | * Fix up bestfree, log the header if necessary. |
@@ -842,7 +843,7 @@ xfs_dir2_block_replace( | |||
842 | * Point to the data entry we need to change. | 843 | * Point to the data entry we need to change. |
843 | */ | 844 | */ |
844 | dep = (xfs_dir2_data_entry_t *) | 845 | dep = (xfs_dir2_data_entry_t *) |
845 | ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(blp[ent].address, ARCH_CONVERT))); | 846 | ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address))); |
846 | ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) != args->inumber); | 847 | ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) != args->inumber); |
847 | /* | 848 | /* |
848 | * Change the inode number to the new value. | 849 | * Change the inode number to the new value. |
@@ -867,8 +868,8 @@ xfs_dir2_block_sort( | |||
867 | 868 | ||
868 | la = a; | 869 | la = a; |
869 | lb = b; | 870 | lb = b; |
870 | return INT_GET(la->hashval, ARCH_CONVERT) < INT_GET(lb->hashval, ARCH_CONVERT) ? -1 : | 871 | return be32_to_cpu(la->hashval) < be32_to_cpu(lb->hashval) ? -1 : |
871 | (INT_GET(la->hashval, ARCH_CONVERT) > INT_GET(lb->hashval, ARCH_CONVERT) ? 1 : 0); | 872 | (be32_to_cpu(la->hashval) > be32_to_cpu(lb->hashval) ? 1 : 0); |
872 | } | 873 | } |
873 | 874 | ||
874 | /* | 875 | /* |
@@ -976,7 +977,7 @@ xfs_dir2_leaf_to_block( | |||
976 | */ | 977 | */ |
977 | lep = XFS_DIR2_BLOCK_LEAF_P(btp); | 978 | lep = XFS_DIR2_BLOCK_LEAF_P(btp); |
978 | for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) { | 979 | for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) { |
979 | if (INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 980 | if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) |
980 | continue; | 981 | continue; |
981 | lep[to++] = leaf->ents[from]; | 982 | lep[to++] = leaf->ents[from]; |
982 | } | 983 | } |
@@ -1135,8 +1136,9 @@ xfs_dir2_sf_to_block( | |||
1135 | tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); | 1136 | tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); |
1136 | INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); | 1137 | INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); |
1137 | xfs_dir2_data_log_entry(tp, bp, dep); | 1138 | xfs_dir2_data_log_entry(tp, bp, dep); |
1138 | INT_SET(blp[0].hashval, ARCH_CONVERT, xfs_dir_hash_dot); | 1139 | blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); |
1139 | INT_SET(blp[0].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)dep - (char *)block)); | 1140 | blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, |
1141 | (char *)dep - (char *)block)); | ||
1140 | /* | 1142 | /* |
1141 | * Create entry for .. | 1143 | * Create entry for .. |
1142 | */ | 1144 | */ |
@@ -1148,8 +1150,9 @@ xfs_dir2_sf_to_block( | |||
1148 | tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); | 1150 | tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); |
1149 | INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); | 1151 | INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); |
1150 | xfs_dir2_data_log_entry(tp, bp, dep); | 1152 | xfs_dir2_data_log_entry(tp, bp, dep); |
1151 | INT_SET(blp[1].hashval, ARCH_CONVERT, xfs_dir_hash_dotdot); | 1153 | blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); |
1152 | INT_SET(blp[1].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, (char *)dep - (char *)block)); | 1154 | blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, |
1155 | (char *)dep - (char *)block)); | ||
1153 | offset = XFS_DIR2_DATA_FIRST_OFFSET; | 1156 | offset = XFS_DIR2_DATA_FIRST_OFFSET; |
1154 | /* | 1157 | /* |
1155 | * Loop over existing entries, stuff them in. | 1158 | * Loop over existing entries, stuff them in. |
@@ -1197,8 +1200,9 @@ xfs_dir2_sf_to_block( | |||
1197 | tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); | 1200 | tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); |
1198 | INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); | 1201 | INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); |
1199 | xfs_dir2_data_log_entry(tp, bp, dep); | 1202 | xfs_dir2_data_log_entry(tp, bp, dep); |
1200 | INT_SET(blp[2 + i].hashval, ARCH_CONVERT, xfs_da_hashname((char *)sfep->name, sfep->namelen)); | 1203 | blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname( |
1201 | INT_SET(blp[2 + i].address, ARCH_CONVERT, XFS_DIR2_BYTE_TO_DATAPTR(mp, | 1204 | (char *)sfep->name, sfep->namelen)); |
1205 | blp[2 + i].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, | ||
1202 | (char *)dep - (char *)block)); | 1206 | (char *)dep - (char *)block)); |
1203 | offset = (int)((char *)(tagp + 1) - (char *)block); | 1207 | offset = (int)((char *)(tagp + 1) - (char *)block); |
1204 | if (++i == INT_GET(sfp->hdr.count, ARCH_CONVERT)) | 1208 | if (++i == INT_GET(sfp->hdr.count, ARCH_CONVERT)) |
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index 0af757873be5..084b134361aa 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c | |||
@@ -144,8 +144,8 @@ xfs_dir2_data_check( | |||
144 | ((char *)dep - (char *)d)); | 144 | ((char *)dep - (char *)d)); |
145 | hash = xfs_da_hashname((char *)dep->name, dep->namelen); | 145 | hash = xfs_da_hashname((char *)dep->name, dep->namelen); |
146 | for (i = 0; i < be32_to_cpu(btp->count); i++) { | 146 | for (i = 0; i < be32_to_cpu(btp->count); i++) { |
147 | if (INT_GET(lep[i].address, ARCH_CONVERT) == addr && | 147 | if (be32_to_cpu(lep[i].address) == addr && |
148 | INT_GET(lep[i].hashval, ARCH_CONVERT) == hash) | 148 | be32_to_cpu(lep[i].hashval) == hash) |
149 | break; | 149 | break; |
150 | } | 150 | } |
151 | ASSERT(i < be32_to_cpu(btp->count)); | 151 | ASSERT(i < be32_to_cpu(btp->count)); |
@@ -158,10 +158,10 @@ xfs_dir2_data_check( | |||
158 | ASSERT(freeseen == 7); | 158 | ASSERT(freeseen == 7); |
159 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { | 159 | if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) { |
160 | for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { | 160 | for (i = stale = 0; i < be32_to_cpu(btp->count); i++) { |
161 | if (INT_GET(lep[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 161 | if (be32_to_cpu(lep[i].address) == XFS_DIR2_NULL_DATAPTR) |
162 | stale++; | 162 | stale++; |
163 | if (i > 0) | 163 | if (i > 0) |
164 | ASSERT(INT_GET(lep[i].hashval, ARCH_CONVERT) >= INT_GET(lep[i - 1].hashval, ARCH_CONVERT)); | 164 | ASSERT(be32_to_cpu(lep[i].hashval) >= be32_to_cpu(lep[i - 1].hashval)); |
165 | } | 165 | } |
166 | ASSERT(count == be32_to_cpu(btp->count) - be32_to_cpu(btp->stale)); | 166 | ASSERT(count == be32_to_cpu(btp->count) - be32_to_cpu(btp->stale)); |
167 | ASSERT(stale == be32_to_cpu(btp->stale)); | 167 | ASSERT(stale == be32_to_cpu(btp->stale)); |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 0d366ab4db17..752fc67354ea 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -222,11 +222,11 @@ xfs_dir2_leaf_addname( | |||
222 | * in a data block, improving the lookup of those entries. | 222 | * in a data block, improving the lookup of those entries. |
223 | */ | 223 | */ |
224 | for (use_block = -1, lep = &leaf->ents[index]; | 224 | for (use_block = -1, lep = &leaf->ents[index]; |
225 | index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; | 225 | index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval; |
226 | index++, lep++) { | 226 | index++, lep++) { |
227 | if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 227 | if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR) |
228 | continue; | 228 | continue; |
229 | i = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); | 229 | i = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address)); |
230 | ASSERT(i < be32_to_cpu(ltp->bestcount)); | 230 | ASSERT(i < be32_to_cpu(ltp->bestcount)); |
231 | ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); | 231 | ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF); |
232 | if (be16_to_cpu(bestsp[i]) >= length) { | 232 | if (be16_to_cpu(bestsp[i]) >= length) { |
@@ -468,7 +468,7 @@ xfs_dir2_leaf_addname( | |||
468 | */ | 468 | */ |
469 | for (lowstale = index - 1; | 469 | for (lowstale = index - 1; |
470 | lowstale >= 0 && | 470 | lowstale >= 0 && |
471 | INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) != | 471 | be32_to_cpu(leaf->ents[lowstale].address) != |
472 | XFS_DIR2_NULL_DATAPTR; | 472 | XFS_DIR2_NULL_DATAPTR; |
473 | lowstale--) | 473 | lowstale--) |
474 | continue; | 474 | continue; |
@@ -479,7 +479,7 @@ xfs_dir2_leaf_addname( | |||
479 | */ | 479 | */ |
480 | for (highstale = index; | 480 | for (highstale = index; |
481 | highstale < be16_to_cpu(leaf->hdr.count) && | 481 | highstale < be16_to_cpu(leaf->hdr.count) && |
482 | INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != | 482 | be32_to_cpu(leaf->ents[highstale].address) != |
483 | XFS_DIR2_NULL_DATAPTR && | 483 | XFS_DIR2_NULL_DATAPTR && |
484 | (lowstale < 0 || | 484 | (lowstale < 0 || |
485 | index - lowstale - 1 >= highstale - index); | 485 | index - lowstale - 1 >= highstale - index); |
@@ -493,7 +493,7 @@ xfs_dir2_leaf_addname( | |||
493 | (highstale == be16_to_cpu(leaf->hdr.count) || | 493 | (highstale == be16_to_cpu(leaf->hdr.count) || |
494 | index - lowstale - 1 < highstale - index)) { | 494 | index - lowstale - 1 < highstale - index)) { |
495 | ASSERT(index - lowstale - 1 >= 0); | 495 | ASSERT(index - lowstale - 1 >= 0); |
496 | ASSERT(INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) == | 496 | ASSERT(be32_to_cpu(leaf->ents[lowstale].address) == |
497 | XFS_DIR2_NULL_DATAPTR); | 497 | XFS_DIR2_NULL_DATAPTR); |
498 | /* | 498 | /* |
499 | * Copy entries up to cover the stale entry | 499 | * Copy entries up to cover the stale entry |
@@ -512,7 +512,7 @@ xfs_dir2_leaf_addname( | |||
512 | */ | 512 | */ |
513 | else { | 513 | else { |
514 | ASSERT(highstale - index >= 0); | 514 | ASSERT(highstale - index >= 0); |
515 | ASSERT(INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) == | 515 | ASSERT(be32_to_cpu(leaf->ents[highstale].address) == |
516 | XFS_DIR2_NULL_DATAPTR); | 516 | XFS_DIR2_NULL_DATAPTR); |
517 | /* | 517 | /* |
518 | * Copy entries down to copver the stale entry | 518 | * Copy entries down to copver the stale entry |
@@ -531,8 +531,9 @@ xfs_dir2_leaf_addname( | |||
531 | /* | 531 | /* |
532 | * Fill in the new leaf entry. | 532 | * Fill in the new leaf entry. |
533 | */ | 533 | */ |
534 | INT_SET(lep->hashval, ARCH_CONVERT, args->hashval); | 534 | lep->hashval = cpu_to_be32(args->hashval); |
535 | INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block, INT_GET(*tagp, ARCH_CONVERT))); | 535 | lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block, |
536 | INT_GET(*tagp, ARCH_CONVERT))); | ||
536 | /* | 537 | /* |
537 | * Log the leaf fields and give up the buffers. | 538 | * Log the leaf fields and give up the buffers. |
538 | */ | 539 | */ |
@@ -581,9 +582,9 @@ xfs_dir2_leaf_check( | |||
581 | */ | 582 | */ |
582 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { | 583 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { |
583 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) | 584 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) |
584 | ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <= | 585 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= |
585 | INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT)); | 586 | be32_to_cpu(leaf->ents[i + 1].hashval)); |
586 | if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 587 | if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR) |
587 | stale++; | 588 | stale++; |
588 | } | 589 | } |
589 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); | 590 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); |
@@ -612,7 +613,7 @@ xfs_dir2_leaf_compact( | |||
612 | * Compress out the stale entries in place. | 613 | * Compress out the stale entries in place. |
613 | */ | 614 | */ |
614 | for (from = to = 0, loglow = -1; from < be16_to_cpu(leaf->hdr.count); from++) { | 615 | for (from = to = 0, loglow = -1; from < be16_to_cpu(leaf->hdr.count); from++) { |
615 | if (INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 616 | if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) |
616 | continue; | 617 | continue; |
617 | /* | 618 | /* |
618 | * Only actually copy the entries that are different. | 619 | * Only actually copy the entries that are different. |
@@ -669,7 +670,7 @@ xfs_dir2_leaf_compact_x1( | |||
669 | */ | 670 | */ |
670 | for (lowstale = index - 1; | 671 | for (lowstale = index - 1; |
671 | lowstale >= 0 && | 672 | lowstale >= 0 && |
672 | INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR; | 673 | be32_to_cpu(leaf->ents[lowstale].address) != XFS_DIR2_NULL_DATAPTR; |
673 | lowstale--) | 674 | lowstale--) |
674 | continue; | 675 | continue; |
675 | /* | 676 | /* |
@@ -678,7 +679,7 @@ xfs_dir2_leaf_compact_x1( | |||
678 | */ | 679 | */ |
679 | for (highstale = index; | 680 | for (highstale = index; |
680 | highstale < be16_to_cpu(leaf->hdr.count) && | 681 | highstale < be16_to_cpu(leaf->hdr.count) && |
681 | INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != XFS_DIR2_NULL_DATAPTR && | 682 | be32_to_cpu(leaf->ents[highstale].address) != XFS_DIR2_NULL_DATAPTR && |
682 | (lowstale < 0 || index - lowstale > highstale - index); | 683 | (lowstale < 0 || index - lowstale > highstale - index); |
683 | highstale++) | 684 | highstale++) |
684 | continue; | 685 | continue; |
@@ -702,7 +703,7 @@ xfs_dir2_leaf_compact_x1( | |||
702 | if (index == from) | 703 | if (index == from) |
703 | newindex = to; | 704 | newindex = to; |
704 | if (from != keepstale && | 705 | if (from != keepstale && |
705 | INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) { | 706 | be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR) { |
706 | if (from == to) | 707 | if (from == to) |
707 | *lowlogp = to; | 708 | *lowlogp = to; |
708 | continue; | 709 | continue; |
@@ -1314,7 +1315,7 @@ xfs_dir2_leaf_lookup( | |||
1314 | */ | 1315 | */ |
1315 | dep = (xfs_dir2_data_entry_t *) | 1316 | dep = (xfs_dir2_data_entry_t *) |
1316 | ((char *)dbp->data + | 1317 | ((char *)dbp->data + |
1317 | XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, INT_GET(lep->address, ARCH_CONVERT))); | 1318 | XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address))); |
1318 | /* | 1319 | /* |
1319 | * Return the found inode number. | 1320 | * Return the found inode number. |
1320 | */ | 1321 | */ |
@@ -1373,17 +1374,17 @@ xfs_dir2_leaf_lookup_int( | |||
1373 | * looking to match the name. | 1374 | * looking to match the name. |
1374 | */ | 1375 | */ |
1375 | for (lep = &leaf->ents[index], dbp = NULL, curdb = -1; | 1376 | for (lep = &leaf->ents[index], dbp = NULL, curdb = -1; |
1376 | index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; | 1377 | index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval; |
1377 | lep++, index++) { | 1378 | lep++, index++) { |
1378 | /* | 1379 | /* |
1379 | * Skip over stale leaf entries. | 1380 | * Skip over stale leaf entries. |
1380 | */ | 1381 | */ |
1381 | if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 1382 | if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR) |
1382 | continue; | 1383 | continue; |
1383 | /* | 1384 | /* |
1384 | * Get the new data block number. | 1385 | * Get the new data block number. |
1385 | */ | 1386 | */ |
1386 | newdb = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); | 1387 | newdb = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address)); |
1387 | /* | 1388 | /* |
1388 | * If it's not the same as the old data block number, | 1389 | * If it's not the same as the old data block number, |
1389 | * need to pitch the old one and read the new one. | 1390 | * need to pitch the old one and read the new one. |
@@ -1406,7 +1407,7 @@ xfs_dir2_leaf_lookup_int( | |||
1406 | */ | 1407 | */ |
1407 | dep = (xfs_dir2_data_entry_t *) | 1408 | dep = (xfs_dir2_data_entry_t *) |
1408 | ((char *)dbp->data + | 1409 | ((char *)dbp->data + |
1409 | XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT))); | 1410 | XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address))); |
1410 | /* | 1411 | /* |
1411 | * If it matches then return it. | 1412 | * If it matches then return it. |
1412 | */ | 1413 | */ |
@@ -1471,9 +1472,9 @@ xfs_dir2_leaf_removename( | |||
1471 | * Point to the leaf entry, use that to point to the data entry. | 1472 | * Point to the leaf entry, use that to point to the data entry. |
1472 | */ | 1473 | */ |
1473 | lep = &leaf->ents[index]; | 1474 | lep = &leaf->ents[index]; |
1474 | db = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); | 1475 | db = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address)); |
1475 | dep = (xfs_dir2_data_entry_t *) | 1476 | dep = (xfs_dir2_data_entry_t *) |
1476 | ((char *)data + XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT))); | 1477 | ((char *)data + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address))); |
1477 | needscan = needlog = 0; | 1478 | needscan = needlog = 0; |
1478 | oldbest = be16_to_cpu(data->hdr.bestfree[0].length); | 1479 | oldbest = be16_to_cpu(data->hdr.bestfree[0].length); |
1479 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); | 1480 | ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); |
@@ -1490,7 +1491,7 @@ xfs_dir2_leaf_removename( | |||
1490 | */ | 1491 | */ |
1491 | be16_add(&leaf->hdr.stale, 1); | 1492 | be16_add(&leaf->hdr.stale, 1); |
1492 | xfs_dir2_leaf_log_header(tp, lbp); | 1493 | xfs_dir2_leaf_log_header(tp, lbp); |
1493 | INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); | 1494 | lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); |
1494 | xfs_dir2_leaf_log_ents(tp, lbp, index, index); | 1495 | xfs_dir2_leaf_log_ents(tp, lbp, index, index); |
1495 | /* | 1496 | /* |
1496 | * Scan the freespace in the data block again if necessary, | 1497 | * Scan the freespace in the data block again if necessary, |
@@ -1604,7 +1605,7 @@ xfs_dir2_leaf_replace( | |||
1604 | */ | 1605 | */ |
1605 | dep = (xfs_dir2_data_entry_t *) | 1606 | dep = (xfs_dir2_data_entry_t *) |
1606 | ((char *)dbp->data + | 1607 | ((char *)dbp->data + |
1607 | XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, INT_GET(lep->address, ARCH_CONVERT))); | 1608 | XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address))); |
1608 | ASSERT(args->inumber != INT_GET(dep->inumber, ARCH_CONVERT)); | 1609 | ASSERT(args->inumber != INT_GET(dep->inumber, ARCH_CONVERT)); |
1609 | /* | 1610 | /* |
1610 | * Put the new inode number in, log it. | 1611 | * Put the new inode number in, log it. |
@@ -1649,7 +1650,7 @@ xfs_dir2_leaf_search_hash( | |||
1649 | hashwant = args->hashval; | 1650 | hashwant = args->hashval; |
1650 | low <= high; ) { | 1651 | low <= high; ) { |
1651 | mid = (low + high) >> 1; | 1652 | mid = (low + high) >> 1; |
1652 | if ((hash = INT_GET(lep[mid].hashval, ARCH_CONVERT)) == hashwant) | 1653 | if ((hash = be32_to_cpu(lep[mid].hashval)) == hashwant) |
1653 | break; | 1654 | break; |
1654 | if (hash < hashwant) | 1655 | if (hash < hashwant) |
1655 | low = mid + 1; | 1656 | low = mid + 1; |
@@ -1660,7 +1661,7 @@ xfs_dir2_leaf_search_hash( | |||
1660 | * Found one, back up through all the equal hash values. | 1661 | * Found one, back up through all the equal hash values. |
1661 | */ | 1662 | */ |
1662 | if (hash == hashwant) { | 1663 | if (hash == hashwant) { |
1663 | while (mid > 0 && INT_GET(lep[mid - 1].hashval, ARCH_CONVERT) == hashwant) { | 1664 | while (mid > 0 && be32_to_cpu(lep[mid - 1].hashval) == hashwant) { |
1664 | mid--; | 1665 | mid--; |
1665 | } | 1666 | } |
1666 | } | 1667 | } |
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h index a1db51b845b9..f57ca1162412 100644 --- a/fs/xfs/xfs_dir2_leaf.h +++ b/fs/xfs/xfs_dir2_leaf.h | |||
@@ -54,8 +54,8 @@ typedef struct xfs_dir2_leaf_hdr { | |||
54 | * Leaf block entry. | 54 | * Leaf block entry. |
55 | */ | 55 | */ |
56 | typedef struct xfs_dir2_leaf_entry { | 56 | typedef struct xfs_dir2_leaf_entry { |
57 | xfs_dahash_t hashval; /* hash value of name */ | 57 | __be32 hashval; /* hash value of name */ |
58 | xfs_dir2_dataptr_t address; /* address of data entry */ | 58 | __be32 address; /* address of data entry */ |
59 | } xfs_dir2_leaf_entry_t; | 59 | } xfs_dir2_leaf_entry_t; |
60 | 60 | ||
61 | /* | 61 | /* |
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index 40e4a2e27765..062e4a99209c 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -223,9 +223,9 @@ xfs_dir2_leafn_add( | |||
223 | compact = be16_to_cpu(leaf->hdr.stale) > 1; | 223 | compact = be16_to_cpu(leaf->hdr.stale) > 1; |
224 | } else | 224 | } else |
225 | compact = 0; | 225 | compact = 0; |
226 | ASSERT(index == 0 || INT_GET(leaf->ents[index - 1].hashval, ARCH_CONVERT) <= args->hashval); | 226 | ASSERT(index == 0 || be32_to_cpu(leaf->ents[index - 1].hashval) <= args->hashval); |
227 | ASSERT(index == be16_to_cpu(leaf->hdr.count) || | 227 | ASSERT(index == be16_to_cpu(leaf->hdr.count) || |
228 | INT_GET(leaf->ents[index].hashval, ARCH_CONVERT) >= args->hashval); | 228 | be32_to_cpu(leaf->ents[index].hashval) >= args->hashval); |
229 | 229 | ||
230 | if (args->justcheck) | 230 | if (args->justcheck) |
231 | return 0; | 231 | return 0; |
@@ -271,7 +271,7 @@ xfs_dir2_leafn_add( | |||
271 | */ | 271 | */ |
272 | for (lowstale = index - 1; | 272 | for (lowstale = index - 1; |
273 | lowstale >= 0 && | 273 | lowstale >= 0 && |
274 | INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) != | 274 | be32_to_cpu(leaf->ents[lowstale].address) != |
275 | XFS_DIR2_NULL_DATAPTR; | 275 | XFS_DIR2_NULL_DATAPTR; |
276 | lowstale--) | 276 | lowstale--) |
277 | continue; | 277 | continue; |
@@ -282,7 +282,7 @@ xfs_dir2_leafn_add( | |||
282 | */ | 282 | */ |
283 | for (highstale = index; | 283 | for (highstale = index; |
284 | highstale < be16_to_cpu(leaf->hdr.count) && | 284 | highstale < be16_to_cpu(leaf->hdr.count) && |
285 | INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != | 285 | be32_to_cpu(leaf->ents[highstale].address) != |
286 | XFS_DIR2_NULL_DATAPTR && | 286 | XFS_DIR2_NULL_DATAPTR && |
287 | (lowstale < 0 || | 287 | (lowstale < 0 || |
288 | index - lowstale - 1 >= highstale - index); | 288 | index - lowstale - 1 >= highstale - index); |
@@ -296,7 +296,7 @@ xfs_dir2_leafn_add( | |||
296 | if (lowstale >= 0 && | 296 | if (lowstale >= 0 && |
297 | (highstale == be16_to_cpu(leaf->hdr.count) || | 297 | (highstale == be16_to_cpu(leaf->hdr.count) || |
298 | index - lowstale - 1 < highstale - index)) { | 298 | index - lowstale - 1 < highstale - index)) { |
299 | ASSERT(INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) == | 299 | ASSERT(be32_to_cpu(leaf->ents[lowstale].address) == |
300 | XFS_DIR2_NULL_DATAPTR); | 300 | XFS_DIR2_NULL_DATAPTR); |
301 | ASSERT(index - lowstale - 1 >= 0); | 301 | ASSERT(index - lowstale - 1 >= 0); |
302 | if (index - lowstale - 1 > 0) | 302 | if (index - lowstale - 1 > 0) |
@@ -312,7 +312,7 @@ xfs_dir2_leafn_add( | |||
312 | * Shift entries down toward the stale slot. | 312 | * Shift entries down toward the stale slot. |
313 | */ | 313 | */ |
314 | else { | 314 | else { |
315 | ASSERT(INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) == | 315 | ASSERT(be32_to_cpu(leaf->ents[highstale].address) == |
316 | XFS_DIR2_NULL_DATAPTR); | 316 | XFS_DIR2_NULL_DATAPTR); |
317 | ASSERT(highstale - index >= 0); | 317 | ASSERT(highstale - index >= 0); |
318 | if (highstale - index > 0) | 318 | if (highstale - index > 0) |
@@ -328,8 +328,9 @@ xfs_dir2_leafn_add( | |||
328 | /* | 328 | /* |
329 | * Insert the new entry, log everything. | 329 | * Insert the new entry, log everything. |
330 | */ | 330 | */ |
331 | INT_SET(lep->hashval, ARCH_CONVERT, args->hashval); | 331 | lep->hashval = cpu_to_be32(args->hashval); |
332 | INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_DB_OFF_TO_DATAPTR(mp, args->blkno, args->index)); | 332 | lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, |
333 | args->blkno, args->index)); | ||
333 | xfs_dir2_leaf_log_header(tp, bp); | 334 | xfs_dir2_leaf_log_header(tp, bp); |
334 | xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh); | 335 | xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh); |
335 | xfs_dir2_leafn_check(dp, bp); | 336 | xfs_dir2_leafn_check(dp, bp); |
@@ -356,10 +357,10 @@ xfs_dir2_leafn_check( | |||
356 | ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp)); | 357 | ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp)); |
357 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { | 358 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { |
358 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) { | 359 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) { |
359 | ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <= | 360 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= |
360 | INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT)); | 361 | be32_to_cpu(leaf->ents[i + 1].hashval)); |
361 | } | 362 | } |
362 | if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 363 | if (be32_to_cpu(leaf->ents[i].address) == XFS_DIR2_NULL_DATAPTR) |
363 | stale++; | 364 | stale++; |
364 | } | 365 | } |
365 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); | 366 | ASSERT(be16_to_cpu(leaf->hdr.stale) == stale); |
@@ -383,7 +384,7 @@ xfs_dir2_leafn_lasthash( | |||
383 | *count = be16_to_cpu(leaf->hdr.count); | 384 | *count = be16_to_cpu(leaf->hdr.count); |
384 | if (!leaf->hdr.count) | 385 | if (!leaf->hdr.count) |
385 | return 0; | 386 | return 0; |
386 | return INT_GET(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval, ARCH_CONVERT); | 387 | return be32_to_cpu(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval); |
387 | } | 388 | } |
388 | 389 | ||
389 | /* | 390 | /* |
@@ -456,17 +457,17 @@ xfs_dir2_leafn_lookup_int( | |||
456 | * Loop over leaf entries with the right hash value. | 457 | * Loop over leaf entries with the right hash value. |
457 | */ | 458 | */ |
458 | for (lep = &leaf->ents[index]; | 459 | for (lep = &leaf->ents[index]; |
459 | index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; | 460 | index < be16_to_cpu(leaf->hdr.count) && be32_to_cpu(lep->hashval) == args->hashval; |
460 | lep++, index++) { | 461 | lep++, index++) { |
461 | /* | 462 | /* |
462 | * Skip stale leaf entries. | 463 | * Skip stale leaf entries. |
463 | */ | 464 | */ |
464 | if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 465 | if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR) |
465 | continue; | 466 | continue; |
466 | /* | 467 | /* |
467 | * Pull the data block number from the entry. | 468 | * Pull the data block number from the entry. |
468 | */ | 469 | */ |
469 | newdb = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); | 470 | newdb = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address)); |
470 | /* | 471 | /* |
471 | * For addname, we're looking for a place to put the new entry. | 472 | * For addname, we're looking for a place to put the new entry. |
472 | * We want to use a data block with an entry of equal | 473 | * We want to use a data block with an entry of equal |
@@ -572,7 +573,7 @@ xfs_dir2_leafn_lookup_int( | |||
572 | */ | 573 | */ |
573 | dep = (xfs_dir2_data_entry_t *) | 574 | dep = (xfs_dir2_data_entry_t *) |
574 | ((char *)curbp->data + | 575 | ((char *)curbp->data + |
575 | XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT))); | 576 | XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address))); |
576 | /* | 577 | /* |
577 | * Compare the entry, return it if it matches. | 578 | * Compare the entry, return it if it matches. |
578 | */ | 579 | */ |
@@ -672,7 +673,7 @@ xfs_dir2_leafn_moveents( | |||
672 | int i; /* temp leaf index */ | 673 | int i; /* temp leaf index */ |
673 | 674 | ||
674 | for (i = start_s, stale = 0; i < start_s + count; i++) { | 675 | for (i = start_s, stale = 0; i < start_s + count; i++) { |
675 | if (INT_GET(leaf_s->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) | 676 | if (be32_to_cpu(leaf_s->ents[i].address) == XFS_DIR2_NULL_DATAPTR) |
676 | stale++; | 677 | stale++; |
677 | } | 678 | } |
678 | } else | 679 | } else |
@@ -723,9 +724,9 @@ xfs_dir2_leafn_order( | |||
723 | ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); | 724 | ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); |
724 | if (be16_to_cpu(leaf1->hdr.count) > 0 && | 725 | if (be16_to_cpu(leaf1->hdr.count) > 0 && |
725 | be16_to_cpu(leaf2->hdr.count) > 0 && | 726 | be16_to_cpu(leaf2->hdr.count) > 0 && |
726 | (INT_GET(leaf2->ents[0].hashval, ARCH_CONVERT) < INT_GET(leaf1->ents[0].hashval, ARCH_CONVERT) || | 727 | (be32_to_cpu(leaf2->ents[0].hashval) < be32_to_cpu(leaf1->ents[0].hashval) || |
727 | INT_GET(leaf2->ents[be16_to_cpu(leaf2->hdr.count) - 1].hashval, ARCH_CONVERT) < | 728 | be32_to_cpu(leaf2->ents[be16_to_cpu(leaf2->hdr.count) - 1].hashval) < |
728 | INT_GET(leaf1->ents[be16_to_cpu(leaf1->hdr.count) - 1].hashval, ARCH_CONVERT))) | 729 | be32_to_cpu(leaf1->ents[be16_to_cpu(leaf1->hdr.count) - 1].hashval))) |
729 | return 1; | 730 | return 1; |
730 | return 0; | 731 | return 0; |
731 | } | 732 | } |
@@ -781,9 +782,9 @@ xfs_dir2_leafn_rebalance( | |||
781 | xfs_dahash_t midhash; /* middle entry hash value */ | 782 | xfs_dahash_t midhash; /* middle entry hash value */ |
782 | 783 | ||
783 | if (mid >= be16_to_cpu(leaf1->hdr.count)) | 784 | if (mid >= be16_to_cpu(leaf1->hdr.count)) |
784 | midhash = INT_GET(leaf2->ents[mid - be16_to_cpu(leaf1->hdr.count)].hashval, ARCH_CONVERT); | 785 | midhash = be32_to_cpu(leaf2->ents[mid - be16_to_cpu(leaf1->hdr.count)].hashval); |
785 | else | 786 | else |
786 | midhash = INT_GET(leaf1->ents[mid].hashval, ARCH_CONVERT); | 787 | midhash = be32_to_cpu(leaf1->ents[mid].hashval); |
787 | isleft = args->hashval <= midhash; | 788 | isleft = args->hashval <= midhash; |
788 | } | 789 | } |
789 | /* | 790 | /* |
@@ -875,9 +876,9 @@ xfs_dir2_leafn_remove( | |||
875 | /* | 876 | /* |
876 | * Extract the data block and offset from the entry. | 877 | * Extract the data block and offset from the entry. |
877 | */ | 878 | */ |
878 | db = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT)); | 879 | db = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address)); |
879 | ASSERT(dblk->blkno == db); | 880 | ASSERT(dblk->blkno == db); |
880 | off = XFS_DIR2_DATAPTR_TO_OFF(mp, INT_GET(lep->address, ARCH_CONVERT)); | 881 | off = XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)); |
881 | ASSERT(dblk->index == off); | 882 | ASSERT(dblk->index == off); |
882 | /* | 883 | /* |
883 | * Kill the leaf entry by marking it stale. | 884 | * Kill the leaf entry by marking it stale. |
@@ -885,7 +886,7 @@ xfs_dir2_leafn_remove( | |||
885 | */ | 886 | */ |
886 | be16_add(&leaf->hdr.stale, 1); | 887 | be16_add(&leaf->hdr.stale, 1); |
887 | xfs_dir2_leaf_log_header(tp, bp); | 888 | xfs_dir2_leaf_log_header(tp, bp); |
888 | INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); | 889 | lep->address = cpu_to_be32(XFS_DIR2_NULL_DATAPTR); |
889 | xfs_dir2_leaf_log_ents(tp, bp, index, index); | 890 | xfs_dir2_leaf_log_ents(tp, bp, index, index); |
890 | /* | 891 | /* |
891 | * Make the data entry free. Keep track of the longest freespace | 892 | * Make the data entry free. Keep track of the longest freespace |
@@ -1269,14 +1270,14 @@ xfs_dir2_leafn_unbalance( | |||
1269 | /* | 1270 | /* |
1270 | * Move the entries from drop to the appropriate end of save. | 1271 | * Move the entries from drop to the appropriate end of save. |
1271 | */ | 1272 | */ |
1272 | drop_blk->hashval = INT_GET(drop_leaf->ents[be16_to_cpu(drop_leaf->hdr.count) - 1].hashval, ARCH_CONVERT); | 1273 | drop_blk->hashval = be32_to_cpu(drop_leaf->ents[be16_to_cpu(drop_leaf->hdr.count) - 1].hashval); |
1273 | if (xfs_dir2_leafn_order(save_blk->bp, drop_blk->bp)) | 1274 | if (xfs_dir2_leafn_order(save_blk->bp, drop_blk->bp)) |
1274 | xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, 0, | 1275 | xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, 0, |
1275 | be16_to_cpu(drop_leaf->hdr.count)); | 1276 | be16_to_cpu(drop_leaf->hdr.count)); |
1276 | else | 1277 | else |
1277 | xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, | 1278 | xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, |
1278 | be16_to_cpu(save_leaf->hdr.count), be16_to_cpu(drop_leaf->hdr.count)); | 1279 | be16_to_cpu(save_leaf->hdr.count), be16_to_cpu(drop_leaf->hdr.count)); |
1279 | save_blk->hashval = INT_GET(save_leaf->ents[be16_to_cpu(save_leaf->hdr.count) - 1].hashval, ARCH_CONVERT); | 1280 | save_blk->hashval = be32_to_cpu(save_leaf->ents[be16_to_cpu(save_leaf->hdr.count) - 1].hashval); |
1280 | xfs_dir2_leafn_check(args->dp, save_blk->bp); | 1281 | xfs_dir2_leafn_check(args->dp, save_blk->bp); |
1281 | } | 1282 | } |
1282 | 1283 | ||
@@ -1903,7 +1904,7 @@ xfs_dir2_node_replace( | |||
1903 | ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC); | 1904 | ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC); |
1904 | dep = (xfs_dir2_data_entry_t *) | 1905 | dep = (xfs_dir2_data_entry_t *) |
1905 | ((char *)data + | 1906 | ((char *)data + |
1906 | XFS_DIR2_DATAPTR_TO_OFF(state->mp, INT_GET(lep->address, ARCH_CONVERT))); | 1907 | XFS_DIR2_DATAPTR_TO_OFF(state->mp, be32_to_cpu(lep->address))); |
1907 | ASSERT(inum != INT_GET(dep->inumber, ARCH_CONVERT)); | 1908 | ASSERT(inum != INT_GET(dep->inumber, ARCH_CONVERT)); |
1908 | /* | 1909 | /* |
1909 | * Fill in the new inode number and log the entry. | 1910 | * Fill in the new inode number and log the entry. |
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c index 35dd003051c5..d98a41d1fe63 100644 --- a/fs/xfs/xfs_dir2_sf.c +++ b/fs/xfs/xfs_dir2_sf.c | |||
@@ -99,7 +99,7 @@ xfs_dir2_block_sfsize( | |||
99 | * Iterate over the block's data entries by using the leaf pointers. | 99 | * Iterate over the block's data entries by using the leaf pointers. |
100 | */ | 100 | */ |
101 | for (i = 0; i < be32_to_cpu(btp->count); i++) { | 101 | for (i = 0; i < be32_to_cpu(btp->count); i++) { |
102 | if ((addr = INT_GET(blp[i].address, ARCH_CONVERT)) == XFS_DIR2_NULL_DATAPTR) | 102 | if ((addr = be32_to_cpu(blp[i].address)) == XFS_DIR2_NULL_DATAPTR) |
103 | continue; | 103 | continue; |
104 | /* | 104 | /* |
105 | * Calculate the pointer to the entry at hand. | 105 | * Calculate the pointer to the entry at hand. |