aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_node.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_node.c')
-rw-r--r--fs/xfs/xfs_dir2_node.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index c32894cb6223..40e4a2e27765 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -217,14 +217,14 @@ xfs_dir2_leafn_add(
217 * a compact. 217 * a compact.
218 */ 218 */
219 219
220 if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == XFS_DIR2_MAX_LEAF_ENTS(mp)) { 220 if (be16_to_cpu(leaf->hdr.count) == XFS_DIR2_MAX_LEAF_ENTS(mp)) {
221 if (!leaf->hdr.stale) 221 if (!leaf->hdr.stale)
222 return XFS_ERROR(ENOSPC); 222 return XFS_ERROR(ENOSPC);
223 compact = INT_GET(leaf->hdr.stale, ARCH_CONVERT) > 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 || INT_GET(leaf->ents[index - 1].hashval, ARCH_CONVERT) <= args->hashval);
227 ASSERT(index == INT_GET(leaf->hdr.count, ARCH_CONVERT) || 227 ASSERT(index == be16_to_cpu(leaf->hdr.count) ||
228 INT_GET(leaf->ents[index].hashval, ARCH_CONVERT) >= args->hashval); 228 INT_GET(leaf->ents[index].hashval, ARCH_CONVERT) >= args->hashval);
229 229
230 if (args->justcheck) 230 if (args->justcheck)
@@ -242,7 +242,7 @@ xfs_dir2_leafn_add(
242 * Set impossible logging indices for this case. 242 * Set impossible logging indices for this case.
243 */ 243 */
244 else if (leaf->hdr.stale) { 244 else if (leaf->hdr.stale) {
245 lfloglow = INT_GET(leaf->hdr.count, ARCH_CONVERT); 245 lfloglow = be16_to_cpu(leaf->hdr.count);
246 lfloghigh = -1; 246 lfloghigh = -1;
247 } 247 }
248 /* 248 /*
@@ -250,12 +250,12 @@ xfs_dir2_leafn_add(
250 */ 250 */
251 if (!leaf->hdr.stale) { 251 if (!leaf->hdr.stale) {
252 lep = &leaf->ents[index]; 252 lep = &leaf->ents[index];
253 if (index < INT_GET(leaf->hdr.count, ARCH_CONVERT)) 253 if (index < be16_to_cpu(leaf->hdr.count))
254 memmove(lep + 1, lep, 254 memmove(lep + 1, lep,
255 (INT_GET(leaf->hdr.count, ARCH_CONVERT) - index) * sizeof(*lep)); 255 (be16_to_cpu(leaf->hdr.count) - index) * sizeof(*lep));
256 lfloglow = index; 256 lfloglow = index;
257 lfloghigh = INT_GET(leaf->hdr.count, ARCH_CONVERT); 257 lfloghigh = be16_to_cpu(leaf->hdr.count);
258 INT_MOD(leaf->hdr.count, ARCH_CONVERT, +1); 258 be16_add(&leaf->hdr.count, 1);
259 } 259 }
260 /* 260 /*
261 * There are stale entries. We'll use one for the new entry. 261 * There are stale entries. We'll use one for the new entry.
@@ -281,7 +281,7 @@ xfs_dir2_leafn_add(
281 * lowstale already found. 281 * lowstale already found.
282 */ 282 */
283 for (highstale = index; 283 for (highstale = index;
284 highstale < INT_GET(leaf->hdr.count, ARCH_CONVERT) && 284 highstale < be16_to_cpu(leaf->hdr.count) &&
285 INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) != 285 INT_GET(leaf->ents[highstale].address, ARCH_CONVERT) !=
286 XFS_DIR2_NULL_DATAPTR && 286 XFS_DIR2_NULL_DATAPTR &&
287 (lowstale < 0 || 287 (lowstale < 0 ||
@@ -294,7 +294,7 @@ xfs_dir2_leafn_add(
294 * Shift entries up toward the stale slot. 294 * Shift entries up toward the stale slot.
295 */ 295 */
296 if (lowstale >= 0 && 296 if (lowstale >= 0 &&
297 (highstale == INT_GET(leaf->hdr.count, ARCH_CONVERT) || 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(INT_GET(leaf->ents[lowstale].address, ARCH_CONVERT) ==
300 XFS_DIR2_NULL_DATAPTR); 300 XFS_DIR2_NULL_DATAPTR);
@@ -323,7 +323,7 @@ xfs_dir2_leafn_add(
323 lfloglow = MIN(index, lfloglow); 323 lfloglow = MIN(index, lfloglow);
324 lfloghigh = MAX(highstale, lfloghigh); 324 lfloghigh = MAX(highstale, lfloghigh);
325 } 325 }
326 INT_MOD(leaf->hdr.stale, ARCH_CONVERT, -1); 326 be16_add(&leaf->hdr.stale, -1);
327 } 327 }
328 /* 328 /*
329 * Insert the new entry, log everything. 329 * Insert the new entry, log everything.
@@ -353,16 +353,16 @@ xfs_dir2_leafn_check(
353 leaf = bp->data; 353 leaf = bp->data;
354 mp = dp->i_mount; 354 mp = dp->i_mount;
355 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 355 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
356 ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) <= XFS_DIR2_MAX_LEAF_ENTS(mp)); 356 ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp));
357 for (i = stale = 0; i < INT_GET(leaf->hdr.count, ARCH_CONVERT); i++) { 357 for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) {
358 if (i + 1 < INT_GET(leaf->hdr.count, ARCH_CONVERT)) { 358 if (i + 1 < be16_to_cpu(leaf->hdr.count)) {
359 ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <= 359 ASSERT(INT_GET(leaf->ents[i].hashval, ARCH_CONVERT) <=
360 INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT)); 360 INT_GET(leaf->ents[i + 1].hashval, ARCH_CONVERT));
361 } 361 }
362 if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) 362 if (INT_GET(leaf->ents[i].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR)
363 stale++; 363 stale++;
364 } 364 }
365 ASSERT(INT_GET(leaf->hdr.stale, ARCH_CONVERT) == stale); 365 ASSERT(be16_to_cpu(leaf->hdr.stale) == stale);
366} 366}
367#endif /* DEBUG */ 367#endif /* DEBUG */
368 368
@@ -380,10 +380,10 @@ xfs_dir2_leafn_lasthash(
380 leaf = bp->data; 380 leaf = bp->data;
381 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 381 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
382 if (count) 382 if (count)
383 *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); 383 *count = be16_to_cpu(leaf->hdr.count);
384 if (!leaf->hdr.count) 384 if (!leaf->hdr.count)
385 return 0; 385 return 0;
386 return INT_GET(leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); 386 return INT_GET(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval, ARCH_CONVERT);
387} 387}
388 388
389/* 389/*
@@ -421,7 +421,7 @@ xfs_dir2_leafn_lookup_int(
421 leaf = bp->data; 421 leaf = bp->data;
422 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 422 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
423#ifdef __KERNEL__ 423#ifdef __KERNEL__
424 ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) > 0); 424 ASSERT(be16_to_cpu(leaf->hdr.count) > 0);
425#endif 425#endif
426 xfs_dir2_leafn_check(dp, bp); 426 xfs_dir2_leafn_check(dp, bp);
427 /* 427 /*
@@ -456,7 +456,7 @@ xfs_dir2_leafn_lookup_int(
456 * Loop over leaf entries with the right hash value. 456 * Loop over leaf entries with the right hash value.
457 */ 457 */
458 for (lep = &leaf->ents[index]; 458 for (lep = &leaf->ents[index];
459 index < INT_GET(leaf->hdr.count, ARCH_CONVERT) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval; 459 index < be16_to_cpu(leaf->hdr.count) && INT_GET(lep->hashval, ARCH_CONVERT) == args->hashval;
460 lep++, index++) { 460 lep++, index++) {
461 /* 461 /*
462 * Skip stale leaf entries. 462 * Skip stale leaf entries.
@@ -619,7 +619,7 @@ xfs_dir2_leafn_lookup_int(
619 * Return the final index, that will be the insertion point. 619 * Return the final index, that will be the insertion point.
620 */ 620 */
621 *indexp = index; 621 *indexp = index;
622 ASSERT(index == INT_GET(leaf->hdr.count, ARCH_CONVERT) || args->oknoent); 622 ASSERT(index == be16_to_cpu(leaf->hdr.count) || args->oknoent);
623 return XFS_ERROR(ENOENT); 623 return XFS_ERROR(ENOENT);
624} 624}
625 625
@@ -657,12 +657,12 @@ xfs_dir2_leafn_moveents(
657 * destination leaf entries, open up a hole in the destination 657 * destination leaf entries, open up a hole in the destination
658 * to hold the new entries. 658 * to hold the new entries.
659 */ 659 */
660 if (start_d < INT_GET(leaf_d->hdr.count, ARCH_CONVERT)) { 660 if (start_d < be16_to_cpu(leaf_d->hdr.count)) {
661 memmove(&leaf_d->ents[start_d + count], &leaf_d->ents[start_d], 661 memmove(&leaf_d->ents[start_d + count], &leaf_d->ents[start_d],
662 (INT_GET(leaf_d->hdr.count, ARCH_CONVERT) - start_d) * 662 (be16_to_cpu(leaf_d->hdr.count) - start_d) *
663 sizeof(xfs_dir2_leaf_entry_t)); 663 sizeof(xfs_dir2_leaf_entry_t));
664 xfs_dir2_leaf_log_ents(tp, bp_d, start_d + count, 664 xfs_dir2_leaf_log_ents(tp, bp_d, start_d + count,
665 count + INT_GET(leaf_d->hdr.count, ARCH_CONVERT) - 1); 665 count + be16_to_cpu(leaf_d->hdr.count) - 1);
666 } 666 }
667 /* 667 /*
668 * If the source has stale leaves, count the ones in the copy range 668 * If the source has stale leaves, count the ones in the copy range
@@ -687,7 +687,7 @@ xfs_dir2_leafn_moveents(
687 * If there are source entries after the ones we copied, 687 * If there are source entries after the ones we copied,
688 * delete the ones we copied by sliding the next ones down. 688 * delete the ones we copied by sliding the next ones down.
689 */ 689 */
690 if (start_s + count < INT_GET(leaf_s->hdr.count, ARCH_CONVERT)) { 690 if (start_s + count < be16_to_cpu(leaf_s->hdr.count)) {
691 memmove(&leaf_s->ents[start_s], &leaf_s->ents[start_s + count], 691 memmove(&leaf_s->ents[start_s], &leaf_s->ents[start_s + count],
692 count * sizeof(xfs_dir2_leaf_entry_t)); 692 count * sizeof(xfs_dir2_leaf_entry_t));
693 xfs_dir2_leaf_log_ents(tp, bp_s, start_s, start_s + count - 1); 693 xfs_dir2_leaf_log_ents(tp, bp_s, start_s, start_s + count - 1);
@@ -695,10 +695,10 @@ xfs_dir2_leafn_moveents(
695 /* 695 /*
696 * Update the headers and log them. 696 * Update the headers and log them.
697 */ 697 */
698 INT_MOD(leaf_s->hdr.count, ARCH_CONVERT, -(count)); 698 be16_add(&leaf_s->hdr.count, -(count));
699 INT_MOD(leaf_s->hdr.stale, ARCH_CONVERT, -(stale)); 699 be16_add(&leaf_s->hdr.stale, -(stale));
700 INT_MOD(leaf_d->hdr.count, ARCH_CONVERT, count); 700 be16_add(&leaf_d->hdr.count, count);
701 INT_MOD(leaf_d->hdr.stale, ARCH_CONVERT, stale); 701 be16_add(&leaf_d->hdr.stale, stale);
702 xfs_dir2_leaf_log_header(tp, bp_s); 702 xfs_dir2_leaf_log_header(tp, bp_s);
703 xfs_dir2_leaf_log_header(tp, bp_d); 703 xfs_dir2_leaf_log_header(tp, bp_d);
704 xfs_dir2_leafn_check(args->dp, bp_s); 704 xfs_dir2_leafn_check(args->dp, bp_s);
@@ -721,11 +721,11 @@ xfs_dir2_leafn_order(
721 leaf2 = leaf2_bp->data; 721 leaf2 = leaf2_bp->data;
722 ASSERT(INT_GET(leaf1->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 722 ASSERT(INT_GET(leaf1->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
723 ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 723 ASSERT(INT_GET(leaf2->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
724 if (INT_GET(leaf1->hdr.count, ARCH_CONVERT) > 0 && 724 if (be16_to_cpu(leaf1->hdr.count) > 0 &&
725 INT_GET(leaf2->hdr.count, ARCH_CONVERT) > 0 && 725 be16_to_cpu(leaf2->hdr.count) > 0 &&
726 (INT_GET(leaf2->ents[0].hashval, ARCH_CONVERT) < INT_GET(leaf1->ents[0].hashval, ARCH_CONVERT) || 726 (INT_GET(leaf2->ents[0].hashval, ARCH_CONVERT) < INT_GET(leaf1->ents[0].hashval, ARCH_CONVERT) ||
727 INT_GET(leaf2->ents[INT_GET(leaf2->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT) < 727 INT_GET(leaf2->ents[be16_to_cpu(leaf2->hdr.count) - 1].hashval, ARCH_CONVERT) <
728 INT_GET(leaf1->ents[INT_GET(leaf1->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT))) 728 INT_GET(leaf1->ents[be16_to_cpu(leaf1->hdr.count) - 1].hashval, ARCH_CONVERT)))
729 return 1; 729 return 1;
730 return 0; 730 return 0;
731} 731}
@@ -768,9 +768,9 @@ xfs_dir2_leafn_rebalance(
768 } 768 }
769 leaf1 = blk1->bp->data; 769 leaf1 = blk1->bp->data;
770 leaf2 = blk2->bp->data; 770 leaf2 = blk2->bp->data;
771 oldsum = INT_GET(leaf1->hdr.count, ARCH_CONVERT) + INT_GET(leaf2->hdr.count, ARCH_CONVERT); 771 oldsum = be16_to_cpu(leaf1->hdr.count) + be16_to_cpu(leaf2->hdr.count);
772#ifdef DEBUG 772#ifdef DEBUG
773 oldstale = INT_GET(leaf1->hdr.stale, ARCH_CONVERT) + INT_GET(leaf2->hdr.stale, ARCH_CONVERT); 773 oldstale = be16_to_cpu(leaf1->hdr.stale) + be16_to_cpu(leaf2->hdr.stale);
774#endif 774#endif
775 mid = oldsum >> 1; 775 mid = oldsum >> 1;
776 /* 776 /*
@@ -780,8 +780,8 @@ xfs_dir2_leafn_rebalance(
780 if (oldsum & 1) { 780 if (oldsum & 1) {
781 xfs_dahash_t midhash; /* middle entry hash value */ 781 xfs_dahash_t midhash; /* middle entry hash value */
782 782
783 if (mid >= INT_GET(leaf1->hdr.count, ARCH_CONVERT)) 783 if (mid >= be16_to_cpu(leaf1->hdr.count))
784 midhash = INT_GET(leaf2->ents[mid - INT_GET(leaf1->hdr.count, ARCH_CONVERT)].hashval, ARCH_CONVERT); 784 midhash = INT_GET(leaf2->ents[mid - be16_to_cpu(leaf1->hdr.count)].hashval, ARCH_CONVERT);
785 else 785 else
786 midhash = INT_GET(leaf1->ents[mid].hashval, ARCH_CONVERT); 786 midhash = INT_GET(leaf1->ents[mid].hashval, ARCH_CONVERT);
787 isleft = args->hashval <= midhash; 787 isleft = args->hashval <= midhash;
@@ -797,30 +797,30 @@ xfs_dir2_leafn_rebalance(
797 * Calculate moved entry count. Positive means left-to-right, 797 * Calculate moved entry count. Positive means left-to-right,
798 * negative means right-to-left. Then move the entries. 798 * negative means right-to-left. Then move the entries.
799 */ 799 */
800 count = INT_GET(leaf1->hdr.count, ARCH_CONVERT) - mid + (isleft == 0); 800 count = be16_to_cpu(leaf1->hdr.count) - mid + (isleft == 0);
801 if (count > 0) 801 if (count > 0)
802 xfs_dir2_leafn_moveents(args, blk1->bp, 802 xfs_dir2_leafn_moveents(args, blk1->bp,
803 INT_GET(leaf1->hdr.count, ARCH_CONVERT) - count, blk2->bp, 0, count); 803 be16_to_cpu(leaf1->hdr.count) - count, blk2->bp, 0, count);
804 else if (count < 0) 804 else if (count < 0)
805 xfs_dir2_leafn_moveents(args, blk2->bp, 0, blk1->bp, 805 xfs_dir2_leafn_moveents(args, blk2->bp, 0, blk1->bp,
806 INT_GET(leaf1->hdr.count, ARCH_CONVERT), count); 806 be16_to_cpu(leaf1->hdr.count), count);
807 ASSERT(INT_GET(leaf1->hdr.count, ARCH_CONVERT) + INT_GET(leaf2->hdr.count, ARCH_CONVERT) == oldsum); 807 ASSERT(be16_to_cpu(leaf1->hdr.count) + be16_to_cpu(leaf2->hdr.count) == oldsum);
808 ASSERT(INT_GET(leaf1->hdr.stale, ARCH_CONVERT) + INT_GET(leaf2->hdr.stale, ARCH_CONVERT) == oldstale); 808 ASSERT(be16_to_cpu(leaf1->hdr.stale) + be16_to_cpu(leaf2->hdr.stale) == oldstale);
809 /* 809 /*
810 * Mark whether we're inserting into the old or new leaf. 810 * Mark whether we're inserting into the old or new leaf.
811 */ 811 */
812 if (INT_GET(leaf1->hdr.count, ARCH_CONVERT) < INT_GET(leaf2->hdr.count, ARCH_CONVERT)) 812 if (be16_to_cpu(leaf1->hdr.count) < be16_to_cpu(leaf2->hdr.count))
813 state->inleaf = swap; 813 state->inleaf = swap;
814 else if (INT_GET(leaf1->hdr.count, ARCH_CONVERT) > INT_GET(leaf2->hdr.count, ARCH_CONVERT)) 814 else if (be16_to_cpu(leaf1->hdr.count) > be16_to_cpu(leaf2->hdr.count))
815 state->inleaf = !swap; 815 state->inleaf = !swap;
816 else 816 else
817 state->inleaf = 817 state->inleaf =
818 swap ^ (blk1->index <= INT_GET(leaf1->hdr.count, ARCH_CONVERT)); 818 swap ^ (blk1->index <= be16_to_cpu(leaf1->hdr.count));
819 /* 819 /*
820 * Adjust the expected index for insertion. 820 * Adjust the expected index for insertion.
821 */ 821 */
822 if (!state->inleaf) 822 if (!state->inleaf)
823 blk2->index = blk1->index - INT_GET(leaf1->hdr.count, ARCH_CONVERT); 823 blk2->index = blk1->index - be16_to_cpu(leaf1->hdr.count);
824 824
825 /* 825 /*
826 * Finally sanity check just to make sure we are not returning a negative index 826 * Finally sanity check just to make sure we are not returning a negative index
@@ -883,7 +883,7 @@ xfs_dir2_leafn_remove(
883 * Kill the leaf entry by marking it stale. 883 * Kill the leaf entry by marking it stale.
884 * Log the leaf block changes. 884 * Log the leaf block changes.
885 */ 885 */
886 INT_MOD(leaf->hdr.stale, ARCH_CONVERT, +1); 886 be16_add(&leaf->hdr.stale, 1);
887 xfs_dir2_leaf_log_header(tp, bp); 887 xfs_dir2_leaf_log_header(tp, bp);
888 INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR); 888 INT_SET(lep->address, ARCH_CONVERT, XFS_DIR2_NULL_DATAPTR);
889 xfs_dir2_leaf_log_ents(tp, bp, index, index); 889 xfs_dir2_leaf_log_ents(tp, bp, index, index);
@@ -1039,7 +1039,7 @@ xfs_dir2_leafn_remove(
1039 *rval = 1039 *rval =
1040 ((uint)sizeof(leaf->hdr) + 1040 ((uint)sizeof(leaf->hdr) +
1041 (uint)sizeof(leaf->ents[0]) * 1041 (uint)sizeof(leaf->ents[0]) *
1042 (INT_GET(leaf->hdr.count, ARCH_CONVERT) - INT_GET(leaf->hdr.stale, ARCH_CONVERT))) < 1042 (be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale))) <
1043 mp->m_dir_magicpct; 1043 mp->m_dir_magicpct;
1044 return 0; 1044 return 0;
1045} 1045}
@@ -1140,7 +1140,7 @@ xfs_dir2_leafn_toosmall(
1140 info = blk->bp->data; 1140 info = blk->bp->data;
1141 ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 1141 ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
1142 leaf = (xfs_dir2_leaf_t *)info; 1142 leaf = (xfs_dir2_leaf_t *)info;
1143 count = INT_GET(leaf->hdr.count, ARCH_CONVERT) - INT_GET(leaf->hdr.stale, ARCH_CONVERT); 1143 count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1144 bytes = (uint)sizeof(leaf->hdr) + count * (uint)sizeof(leaf->ents[0]); 1144 bytes = (uint)sizeof(leaf->hdr) + count * (uint)sizeof(leaf->ents[0]);
1145 if (bytes > (state->blocksize >> 1)) { 1145 if (bytes > (state->blocksize >> 1)) {
1146 /* 1146 /*
@@ -1194,11 +1194,11 @@ xfs_dir2_leafn_toosmall(
1194 * Count bytes in the two blocks combined. 1194 * Count bytes in the two blocks combined.
1195 */ 1195 */
1196 leaf = (xfs_dir2_leaf_t *)info; 1196 leaf = (xfs_dir2_leaf_t *)info;
1197 count = INT_GET(leaf->hdr.count, ARCH_CONVERT) - INT_GET(leaf->hdr.stale, ARCH_CONVERT); 1197 count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1198 bytes = state->blocksize - (state->blocksize >> 2); 1198 bytes = state->blocksize - (state->blocksize >> 2);
1199 leaf = bp->data; 1199 leaf = bp->data;
1200 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); 1200 ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
1201 count += INT_GET(leaf->hdr.count, ARCH_CONVERT) - INT_GET(leaf->hdr.stale, ARCH_CONVERT); 1201 count += be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1202 bytes -= count * (uint)sizeof(leaf->ents[0]); 1202 bytes -= count * (uint)sizeof(leaf->ents[0]);
1203 /* 1203 /*
1204 * Fits with at least 25% to spare. 1204 * Fits with at least 25% to spare.
@@ -1262,21 +1262,21 @@ xfs_dir2_leafn_unbalance(
1262 * If there are any stale leaf entries, take this opportunity 1262 * If there are any stale leaf entries, take this opportunity
1263 * to purge them. 1263 * to purge them.
1264 */ 1264 */
1265 if (INT_GET(drop_leaf->hdr.stale, ARCH_CONVERT)) 1265 if (drop_leaf->hdr.stale)
1266 xfs_dir2_leaf_compact(args, drop_blk->bp); 1266 xfs_dir2_leaf_compact(args, drop_blk->bp);
1267 if (INT_GET(save_leaf->hdr.stale, ARCH_CONVERT)) 1267 if (save_leaf->hdr.stale)
1268 xfs_dir2_leaf_compact(args, save_blk->bp); 1268 xfs_dir2_leaf_compact(args, save_blk->bp);
1269 /* 1269 /*
1270 * Move the entries from drop to the appropriate end of save. 1270 * Move the entries from drop to the appropriate end of save.
1271 */ 1271 */
1272 drop_blk->hashval = INT_GET(drop_leaf->ents[INT_GET(drop_leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); 1272 drop_blk->hashval = INT_GET(drop_leaf->ents[be16_to_cpu(drop_leaf->hdr.count) - 1].hashval, ARCH_CONVERT);
1273 if (xfs_dir2_leafn_order(save_blk->bp, drop_blk->bp)) 1273 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, 1274 xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, 0,
1275 INT_GET(drop_leaf->hdr.count, ARCH_CONVERT)); 1275 be16_to_cpu(drop_leaf->hdr.count));
1276 else 1276 else
1277 xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp, 1277 xfs_dir2_leafn_moveents(args, drop_blk->bp, 0, save_blk->bp,
1278 INT_GET(save_leaf->hdr.count, ARCH_CONVERT), INT_GET(drop_leaf->hdr.count, ARCH_CONVERT)); 1278 be16_to_cpu(save_leaf->hdr.count), be16_to_cpu(drop_leaf->hdr.count));
1279 save_blk->hashval = INT_GET(save_leaf->ents[INT_GET(save_leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); 1279 save_blk->hashval = INT_GET(save_leaf->ents[be16_to_cpu(save_leaf->hdr.count) - 1].hashval, ARCH_CONVERT);
1280 xfs_dir2_leafn_check(args->dp, save_blk->bp); 1280 xfs_dir2_leafn_check(args->dp, save_blk->bp);
1281} 1281}
1282 1282