@@ -749,8 +749,7 @@ xfs_btree_get_block(
749749 int level , /* level in btree */
750750 struct xfs_buf * * bpp ) /* buffer containing the block */
751751{
752- if (cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE &&
753- level == cur -> bc_nlevels - 1 ) {
752+ if (xfs_btree_at_iroot (cur , level )) {
754753 * bpp = NULL ;
755754 return xfs_btree_get_iroot (cur );
756755 }
@@ -992,8 +991,7 @@ xfs_btree_readahead(
992991 * No readahead needed if we are at the root level and the
993992 * btree root is stored in the inode.
994993 */
995- if (cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE &&
996- lev == cur -> bc_nlevels - 1 )
994+ if (xfs_btree_at_iroot (cur , lev ))
997995 return 0 ;
998996
999997 if ((cur -> bc_levels [lev ].ra | lr ) == cur -> bc_levels [lev ].ra )
@@ -1814,8 +1812,7 @@ xfs_btree_lookup_get_block(
18141812 int error = 0 ;
18151813
18161814 /* special case the root block if in an inode */
1817- if (cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE &&
1818- level == cur -> bc_nlevels - 1 ) {
1815+ if (xfs_btree_at_iroot (cur , level )) {
18191816 * blkp = xfs_btree_get_iroot (cur );
18201817 return 0 ;
18211818 }
@@ -2350,8 +2347,7 @@ xfs_btree_lshift(
23502347 int error ; /* error return value */
23512348 int i ;
23522349
2353- if ((cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE ) &&
2354- level == cur -> bc_nlevels - 1 )
2350+ if (xfs_btree_at_iroot (cur , level ))
23552351 goto out0 ;
23562352
23572353 /* Set up variables for this block as "right". */
@@ -2546,8 +2542,7 @@ xfs_btree_rshift(
25462542 int error ; /* error return value */
25472543 int i ; /* loop counter */
25482544
2549- if (cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE &&
2550- level == cur -> bc_nlevels - 1 )
2545+ if (xfs_btree_at_iroot (cur , level ))
25512546 goto out0 ;
25522547
25532548 /* Set up variables for this block as "left". */
@@ -3246,8 +3241,7 @@ xfs_btree_make_block_unfull(
32463241{
32473242 int error = 0 ;
32483243
3249- if (cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE &&
3250- level == cur -> bc_nlevels - 1 ) {
3244+ if (xfs_btree_at_iroot (cur , level )) {
32513245 struct xfs_inode * ip = cur -> bc_ino .ip ;
32523246
32533247 if (numrecs < cur -> bc_ops -> get_dmaxrecs (cur , level )) {
@@ -3856,27 +3850,25 @@ xfs_btree_delrec(
38563850 * Try to get rid of the next level down. If we can't then there's
38573851 * nothing left to do.
38583852 */
3859- if (level == cur -> bc_nlevels - 1 ) {
3860- if (cur -> bc_ops -> type == XFS_BTREE_TYPE_INODE ) {
3861- xfs_iroot_realloc (cur -> bc_ino .ip , -1 ,
3862- cur -> bc_ino .whichfork );
3853+ if (xfs_btree_at_iroot (cur , level )) {
3854+ xfs_iroot_realloc (cur -> bc_ino .ip , -1 , cur -> bc_ino .whichfork );
38633855
3864- error = xfs_btree_kill_iroot (cur );
3865- if (error )
3866- goto error0 ;
3856+ error = xfs_btree_kill_iroot (cur );
3857+ if (error )
3858+ goto error0 ;
38673859
3868- error = xfs_btree_dec_cursor (cur , level , stat );
3869- if (error )
3870- goto error0 ;
3871- * stat = 1 ;
3872- return 0 ;
3873- }
3860+ error = xfs_btree_dec_cursor (cur , level , stat );
3861+ if (error )
3862+ goto error0 ;
3863+ * stat = 1 ;
3864+ return 0 ;
3865+ }
38743866
3875- /*
3876- * If this is the root level, and there's only one entry left,
3877- * and it's NOT the leaf level, then we can get rid of this
3878- * level.
3879- */
3867+ /*
3868+ * If this is the root level, and there's only one entry left, and it's
3869+ * NOT the leaf level, then we can get rid of this level.
3870+ */
3871+ if ( level == cur -> bc_nlevels - 1 ) {
38803872 if (numrecs == 1 && level > 0 ) {
38813873 union xfs_btree_ptr * pp ;
38823874 /*
0 commit comments