]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/xfs_inode_buf.c
xfs: Introduce xfs_iext_max_nextents() helper
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_inode_buf.c
index 28662aa71a3d33427b9ae61ffd8d262bf6499a40..12c117c902cc74c0f7be90c7a6469aff1fa1221a 100644 (file)
@@ -334,6 +334,7 @@ xfs_dinode_verify_fork(
        int                     whichfork)
 {
        uint32_t                di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
+       xfs_extnum_t            max_extents;
 
        switch (XFS_DFORK_FORMAT(dip, whichfork)) {
        case XFS_DINODE_FMT_LOCAL:
@@ -355,12 +356,9 @@ xfs_dinode_verify_fork(
                        return __this_address;
                break;
        case XFS_DINODE_FMT_BTREE:
-               if (whichfork == XFS_ATTR_FORK) {
-                       if (di_nextents > MAXAEXTNUM)
-                               return __this_address;
-               } else if (di_nextents > MAXEXTNUM) {
+               max_extents = xfs_iext_max_nextents(whichfork);
+               if (di_nextents > max_extents)
                        return __this_address;
-               }
                break;
        default:
                return __this_address;