aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 0c65ba2faa43..73b604e15dcd 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -622,7 +622,7 @@ xfs_iformat_btree(
622 ifp = XFS_IFORK_PTR(ip, whichfork); 622 ifp = XFS_IFORK_PTR(ip, whichfork);
623 dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); 623 dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
624 size = XFS_BMAP_BROOT_SPACE(dfp); 624 size = XFS_BMAP_BROOT_SPACE(dfp);
625 nrecs = XFS_BMAP_BROOT_NUMRECS(dfp); 625 nrecs = be16_to_cpu(dfp->bb_numrecs);
626 626
627 /* 627 /*
628 * blow out if -- fork has less extents than can fit in 628 * blow out if -- fork has less extents than can fit in
@@ -650,8 +650,9 @@ xfs_iformat_btree(
650 * Copy and convert from the on-disk structure 650 * Copy and convert from the on-disk structure
651 * to the in-memory structure. 651 * to the in-memory structure.
652 */ 652 */
653 xfs_bmdr_to_bmbt(dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), 653 xfs_bmdr_to_bmbt(ip->i_mount, dfp,
654 ifp->if_broot, size); 654 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork),
655 ifp->if_broot, size);
655 ifp->if_flags &= ~XFS_IFEXTENTS; 656 ifp->if_flags &= ~XFS_IFEXTENTS;
656 ifp->if_flags |= XFS_IFBROOT; 657 ifp->if_flags |= XFS_IFBROOT;
657 658
@@ -2348,6 +2349,7 @@ xfs_iroot_realloc(
2348 int rec_diff, 2349 int rec_diff,
2349 int whichfork) 2350 int whichfork)
2350{ 2351{
2352 struct xfs_mount *mp = ip->i_mount;
2351 int cur_max; 2353 int cur_max;
2352 xfs_ifork_t *ifp; 2354 xfs_ifork_t *ifp;
2353 xfs_bmbt_block_t *new_broot; 2355 xfs_bmbt_block_t *new_broot;
@@ -2383,7 +2385,7 @@ xfs_iroot_realloc(
2383 * location. The records don't change location because 2385 * location. The records don't change location because
2384 * they are kept butted up against the btree block header. 2386 * they are kept butted up against the btree block header.
2385 */ 2387 */
2386 cur_max = XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes); 2388 cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0);
2387 new_max = cur_max + rec_diff; 2389 new_max = cur_max + rec_diff;
2388 new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max); 2390 new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max);
2389 ifp->if_broot = (xfs_bmbt_block_t *) 2391 ifp->if_broot = (xfs_bmbt_block_t *)
@@ -2391,10 +2393,10 @@ xfs_iroot_realloc(
2391 new_size, 2393 new_size,
2392 (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */ 2394 (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */
2393 KM_SLEEP); 2395 KM_SLEEP);
2394 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(ifp->if_broot, 1, 2396 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
2395 ifp->if_broot_bytes); 2397 ifp->if_broot_bytes);
2396 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(ifp->if_broot, 1, 2398 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
2397 (int)new_size); 2399 (int)new_size);
2398 ifp->if_broot_bytes = (int)new_size; 2400 ifp->if_broot_bytes = (int)new_size;
2399 ASSERT(ifp->if_broot_bytes <= 2401 ASSERT(ifp->if_broot_bytes <=
2400 XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ); 2402 XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ);
@@ -2408,7 +2410,7 @@ xfs_iroot_realloc(
2408 * records, just get rid of the root and clear the status bit. 2410 * records, just get rid of the root and clear the status bit.
2409 */ 2411 */
2410 ASSERT((ifp->if_broot != NULL) && (ifp->if_broot_bytes > 0)); 2412 ASSERT((ifp->if_broot != NULL) && (ifp->if_broot_bytes > 0));
2411 cur_max = XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes); 2413 cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0);
2412 new_max = cur_max + rec_diff; 2414 new_max = cur_max + rec_diff;
2413 ASSERT(new_max >= 0); 2415 ASSERT(new_max >= 0);
2414 if (new_max > 0) 2416 if (new_max > 0)
@@ -2442,9 +2444,9 @@ xfs_iroot_realloc(
2442 /* 2444 /*
2443 * Then copy the pointers. 2445 * Then copy the pointers.
2444 */ 2446 */
2445 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(ifp->if_broot, 1, 2447 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
2446 ifp->if_broot_bytes); 2448 ifp->if_broot_bytes);
2447 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(new_broot, 1, 2449 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, new_broot, 1,
2448 (int)new_size); 2450 (int)new_size);
2449 memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t)); 2451 memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t));
2450 } 2452 }
@@ -2920,7 +2922,7 @@ xfs_iflush_fork(
2920 ASSERT(ifp->if_broot_bytes <= 2922 ASSERT(ifp->if_broot_bytes <=
2921 (XFS_IFORK_SIZE(ip, whichfork) + 2923 (XFS_IFORK_SIZE(ip, whichfork) +
2922 XFS_BROOT_SIZE_ADJ)); 2924 XFS_BROOT_SIZE_ADJ));
2923 xfs_bmbt_to_bmdr(ifp->if_broot, ifp->if_broot_bytes, 2925 xfs_bmbt_to_bmdr(mp, ifp->if_broot, ifp->if_broot_bytes,
2924 (xfs_bmdr_block_t *)cp, 2926 (xfs_bmdr_block_t *)cp,
2925 XFS_DFORK_SIZE(dip, mp, whichfork)); 2927 XFS_DFORK_SIZE(dip, mp, whichfork));
2926 } 2928 }