diff options
Diffstat (limited to 'fs/xfs/xfs_btree.c')
-rw-r--r-- | fs/xfs/xfs_btree.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index e53e317b1582..121ea99e615a 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c | |||
@@ -853,18 +853,22 @@ xfs_btree_set_sibling( | |||
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||
856 | STATIC void | 856 | void |
857 | xfs_btree_init_block( | 857 | xfs_btree_init_block( |
858 | struct xfs_btree_cur *cur, | 858 | struct xfs_mount *mp, |
859 | int level, | 859 | struct xfs_buf *bp, |
860 | int numrecs, | 860 | __u32 magic, |
861 | struct xfs_btree_block *new) /* new block */ | 861 | __u16 level, |
862 | __u16 numrecs, | ||
863 | unsigned int flags) | ||
862 | { | 864 | { |
863 | new->bb_magic = cpu_to_be32(xfs_magics[cur->bc_btnum]); | 865 | struct xfs_btree_block *new = XFS_BUF_TO_BLOCK(bp); |
866 | |||
867 | new->bb_magic = cpu_to_be32(magic); | ||
864 | new->bb_level = cpu_to_be16(level); | 868 | new->bb_level = cpu_to_be16(level); |
865 | new->bb_numrecs = cpu_to_be16(numrecs); | 869 | new->bb_numrecs = cpu_to_be16(numrecs); |
866 | 870 | ||
867 | if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { | 871 | if (flags & XFS_BTREE_LONG_PTRS) { |
868 | new->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO); | 872 | new->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO); |
869 | new->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO); | 873 | new->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO); |
870 | } else { | 874 | } else { |
@@ -873,6 +877,17 @@ xfs_btree_init_block( | |||
873 | } | 877 | } |
874 | } | 878 | } |
875 | 879 | ||
880 | STATIC void | ||
881 | xfs_btree_init_block_cur( | ||
882 | struct xfs_btree_cur *cur, | ||
883 | int level, | ||
884 | int numrecs, | ||
885 | struct xfs_buf *bp) | ||
886 | { | ||
887 | xfs_btree_init_block(cur->bc_mp, bp, xfs_magics[cur->bc_btnum], | ||
888 | level, numrecs, cur->bc_flags); | ||
889 | } | ||
890 | |||
876 | /* | 891 | /* |
877 | * Return true if ptr is the last record in the btree and | 892 | * Return true if ptr is the last record in the btree and |
878 | * we need to track updateѕ to this record. The decision | 893 | * we need to track updateѕ to this record. The decision |
@@ -2183,7 +2198,7 @@ xfs_btree_split( | |||
2183 | goto error0; | 2198 | goto error0; |
2184 | 2199 | ||
2185 | /* Fill in the btree header for the new right block. */ | 2200 | /* Fill in the btree header for the new right block. */ |
2186 | xfs_btree_init_block(cur, xfs_btree_get_level(left), 0, right); | 2201 | xfs_btree_init_block_cur(cur, xfs_btree_get_level(left), 0, rbp); |
2187 | 2202 | ||
2188 | /* | 2203 | /* |
2189 | * Split the entries between the old and the new block evenly. | 2204 | * Split the entries between the old and the new block evenly. |
@@ -2492,7 +2507,7 @@ xfs_btree_new_root( | |||
2492 | nptr = 2; | 2507 | nptr = 2; |
2493 | } | 2508 | } |
2494 | /* Fill in the new block's btree header and log it. */ | 2509 | /* Fill in the new block's btree header and log it. */ |
2495 | xfs_btree_init_block(cur, cur->bc_nlevels, 2, new); | 2510 | xfs_btree_init_block_cur(cur, cur->bc_nlevels, 2, nbp); |
2496 | xfs_btree_log_block(cur, nbp, XFS_BB_ALL_BITS); | 2511 | xfs_btree_log_block(cur, nbp, XFS_BB_ALL_BITS); |
2497 | ASSERT(!xfs_btree_ptr_is_null(cur, &lptr) && | 2512 | ASSERT(!xfs_btree_ptr_is_null(cur, &lptr) && |
2498 | !xfs_btree_ptr_is_null(cur, &rptr)); | 2513 | !xfs_btree_ptr_is_null(cur, &rptr)); |