diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 02:14:34 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:14:34 -0400 |
commit | 7cc95a821df8f09a5d37a923cf8c3a7c3ee00c29 (patch) | |
tree | 8fde02d4c9a52b7da7b3e961f8a23cf4b493a4a4 /fs/xfs/xfs_inode.c | |
parent | 136341b41ad4883bd668120f727a52c42331fe8a (diff) |
[XFS] Always use struct xfs_btree_block instead of short / longform
structures.
Always use the generic xfs_btree_block type instead of the short / long
structures. Add XFS_BTREE_SBLOCK_LEN / XFS_BTREE_LBLOCK_LEN defines for
the length of a short / long form block. The rationale for this is that we
will grow more btree block header variants to support CRCs and other RAS
information, and always accessing them through the same datatype with
unions for the short / long form pointers makes implementing this much
easier.
SGI-PV: 988146
SGI-Modid: xfs-linux-melb:xfs-kern:32300a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Donald Douwsma <donaldd@sgi.com>
Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 7b4f13c710d6..bc33762abc49 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2352,7 +2352,7 @@ xfs_iroot_realloc( | |||
2352 | struct xfs_mount *mp = ip->i_mount; | 2352 | struct xfs_mount *mp = ip->i_mount; |
2353 | int cur_max; | 2353 | int cur_max; |
2354 | xfs_ifork_t *ifp; | 2354 | xfs_ifork_t *ifp; |
2355 | xfs_bmbt_block_t *new_broot; | 2355 | struct xfs_btree_block *new_broot; |
2356 | int new_max; | 2356 | int new_max; |
2357 | size_t new_size; | 2357 | size_t new_size; |
2358 | char *np; | 2358 | char *np; |
@@ -2373,8 +2373,7 @@ xfs_iroot_realloc( | |||
2373 | */ | 2373 | */ |
2374 | if (ifp->if_broot_bytes == 0) { | 2374 | if (ifp->if_broot_bytes == 0) { |
2375 | new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(rec_diff); | 2375 | new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(rec_diff); |
2376 | ifp->if_broot = (xfs_bmbt_block_t*)kmem_alloc(new_size, | 2376 | ifp->if_broot = kmem_alloc(new_size, KM_SLEEP); |
2377 | KM_SLEEP); | ||
2378 | ifp->if_broot_bytes = (int)new_size; | 2377 | ifp->if_broot_bytes = (int)new_size; |
2379 | return; | 2378 | return; |
2380 | } | 2379 | } |
@@ -2388,9 +2387,7 @@ xfs_iroot_realloc( | |||
2388 | cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0); | 2387 | cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0); |
2389 | new_max = cur_max + rec_diff; | 2388 | new_max = cur_max + rec_diff; |
2390 | new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max); | 2389 | new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max); |
2391 | ifp->if_broot = (xfs_bmbt_block_t *) | 2390 | ifp->if_broot = kmem_realloc(ifp->if_broot, new_size, |
2392 | kmem_realloc(ifp->if_broot, | ||
2393 | new_size, | ||
2394 | (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */ | 2391 | (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */ |
2395 | KM_SLEEP); | 2392 | KM_SLEEP); |
2396 | op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, | 2393 | op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, |
@@ -2418,11 +2415,11 @@ xfs_iroot_realloc( | |||
2418 | else | 2415 | else |
2419 | new_size = 0; | 2416 | new_size = 0; |
2420 | if (new_size > 0) { | 2417 | if (new_size > 0) { |
2421 | new_broot = (xfs_bmbt_block_t *)kmem_alloc(new_size, KM_SLEEP); | 2418 | new_broot = kmem_alloc(new_size, KM_SLEEP); |
2422 | /* | 2419 | /* |
2423 | * First copy over the btree block header. | 2420 | * First copy over the btree block header. |
2424 | */ | 2421 | */ |
2425 | memcpy(new_broot, ifp->if_broot, sizeof(xfs_bmbt_block_t)); | 2422 | memcpy(new_broot, ifp->if_broot, XFS_BTREE_LBLOCK_LEN); |
2426 | } else { | 2423 | } else { |
2427 | new_broot = NULL; | 2424 | new_broot = NULL; |
2428 | ifp->if_flags &= ~XFS_IFBROOT; | 2425 | ifp->if_flags &= ~XFS_IFBROOT; |