]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Introduce xfs_dfork_nextents() helper
authorChandan Babu R <chandan.babu@oracle.com>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
Source kernel commit: dd95a6ce31d6441dfd5fd3aa5d7208b0fc61782f

This commit replaces the macro XFS_DFORK_NEXTENTS() with the helper function
xfs_dfork_nextents(). As of this commit, xfs_dfork_nextents() returns the same
value as XFS_DFORK_NEXTENTS(). A future commit which extends inode's extent
counter fields will add more logic to this helper.

This commit also replaces direct accesses to xfs_dinode->di_[a]nextents
with calls to xfs_dfork_nextents().

No functional changes have been made.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
13 files changed:
db/bmap.c
db/btdump.c
db/check.c
db/frag.c
db/inode.c
db/metadump.c
libxfs/xfs_format.h
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_fork.c
libxfs/xfs_inode_fork.h
repair/attr_repair.c
repair/dinode.c
repair/prefetch.c

index ef6fa2b06bbb0d1c05da62ed776e424516573393..874135f001ea00d3f27a0fde3a7d7559e2a9a7ac 100644 (file)
--- a/db/bmap.c
+++ b/db/bmap.c
@@ -68,7 +68,7 @@ bmap(
        ASSERT(fmt == XFS_DINODE_FMT_LOCAL || fmt == XFS_DINODE_FMT_EXTENTS ||
                fmt == XFS_DINODE_FMT_BTREE);
        if (fmt == XFS_DINODE_FMT_EXTENTS) {
-               nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
+               nextents = xfs_dfork_nextents(dip, whichfork);
                xp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
                for (ep = xp; ep < &xp[nextents] && n < nex; ep++) {
                        if (!bmap_one_extent(ep, &curoffset, eoffset, &n, bep))
@@ -158,9 +158,9 @@ bmap_f(
                push_cur();
                set_cur_inode(iocur_top->ino);
                dip = iocur_top->data;
-               if (be32_to_cpu(dip->di_nextents))
+               if (xfs_dfork_data_extents(dip))
                        dfork = 1;
-               if (be16_to_cpu(dip->di_anextents))
+               if (xfs_dfork_attr_extents(dip))
                        afork = 1;
                pop_cur();
        }
index cb9ca082a6eda89a8eef292f3c54076e8a5bd822..81642cde2b6d8fd0e85c6ceaa79ab050918cfb21 100644 (file)
@@ -166,13 +166,13 @@ dump_inode(
 
        dip = iocur_top->data;
        if (attrfork) {
-               if (!dip->di_anextents ||
+               if (!xfs_dfork_attr_extents(dip) ||
                    dip->di_aformat != XFS_DINODE_FMT_BTREE) {
                        dbprintf(_("attr fork not in btree format\n"));
                        return 0;
                }
        } else {
-               if (!dip->di_nextents ||
+               if (!xfs_dfork_data_extents(dip) ||
                    dip->di_format != XFS_DINODE_FMT_BTREE) {
                        dbprintf(_("data fork not in btree format\n"));
                        return 0;
index d09e33a48172e212aa5534413bf9f84bc2a5e993..fb28994d050435829223460f84afb1cce7ba8c2a 100644 (file)
@@ -2713,7 +2713,7 @@ process_exinode(
        xfs_bmbt_rec_t          *rp;
 
        rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
-       *nex = XFS_DFORK_NEXTENTS(dip, whichfork);
+       *nex = xfs_dfork_nextents(dip, whichfork);
        if (*nex < 0 || *nex > XFS_DFORK_SIZE(dip, mp, whichfork) /
                                                sizeof(xfs_bmbt_rec_t)) {
                if (!sflag || id->ilist)
@@ -2737,12 +2737,14 @@ process_inode(
        inodata_t               *id = NULL;
        xfs_ino_t               ino;
        xfs_extnum_t            nextents = 0;
+       xfs_extnum_t            dnextents;
        int                     security;
        xfs_rfsblock_t          totblocks;
        xfs_rfsblock_t          totdblocks = 0;
        xfs_rfsblock_t          totiblocks = 0;
        dbm_t                   type;
        xfs_extnum_t            anextents = 0;
+       xfs_extnum_t            danextents;
        xfs_rfsblock_t          atotdblocks = 0;
        xfs_rfsblock_t          atotiblocks = 0;
        xfs_qcnt_t              bc = 0;
@@ -2871,14 +2873,17 @@ process_inode(
                error++;
                return;
        }
+
+       dnextents = xfs_dfork_data_extents(dip);
+       danextents = xfs_dfork_attr_extents(dip);
+
        if (verbose || (id && id->ilist) || CHECK_BLIST(bno))
                dbprintf(_("inode %lld mode %#o fmt %s "
                         "afmt %s "
                         "nex %d anex %d nblk %lld sz %lld%s%s%s%s%s%s%s\n"),
                        id->ino, mode, fmtnames[(int)dip->di_format],
                        fmtnames[(int)dip->di_aformat],
-                       be32_to_cpu(dip->di_nextents),
-                       be16_to_cpu(dip->di_anextents),
+                       dnextents, danextents,
                        be64_to_cpu(dip->di_nblocks), be64_to_cpu(dip->di_size),
                        diflags & XFS_DIFLAG_REALTIME ? " rt" : "",
                        diflags & XFS_DIFLAG_PREALLOC ? " pre" : "",
@@ -2893,25 +2898,25 @@ process_inode(
                type = DBM_DIR;
                if (dip->di_format == XFS_DINODE_FMT_LOCAL)
                        break;
-               blkmap = blkmap_alloc(be32_to_cpu(dip->di_nextents));
+               blkmap = blkmap_alloc(dnextents);
                break;
        case S_IFREG:
                if (diflags & XFS_DIFLAG_REALTIME)
                        type = DBM_RTDATA;
                else if (id->ino == mp->m_sb.sb_rbmino) {
                        type = DBM_RTBITMAP;
-                       blkmap = blkmap_alloc(be32_to_cpu(dip->di_nextents));
+                       blkmap = blkmap_alloc(dnextents);
                        addlink_inode(id);
                } else if (id->ino == mp->m_sb.sb_rsumino) {
                        type = DBM_RTSUM;
-                       blkmap = blkmap_alloc(be32_to_cpu(dip->di_nextents));
+                       blkmap = blkmap_alloc(dnextents);
                        addlink_inode(id);
                }
                else if (id->ino == mp->m_sb.sb_uquotino ||
                         id->ino == mp->m_sb.sb_gquotino ||
                         id->ino == mp->m_sb.sb_pquotino) {
                        type = DBM_QUOTA;
-                       blkmap = blkmap_alloc(be32_to_cpu(dip->di_nextents));
+                       blkmap = blkmap_alloc(dnextents);
                        addlink_inode(id);
                }
                else
@@ -2993,17 +2998,17 @@ process_inode(
                                be64_to_cpu(dip->di_nblocks), id->ino, totblocks);
                error++;
        }
-       if (nextents != be32_to_cpu(dip->di_nextents)) {
+       if (nextents != dnextents) {
                if (v)
                        dbprintf(_("bad nextents %d for inode %lld, counted %d\n"),
-                               be32_to_cpu(dip->di_nextents), id->ino, nextents);
+                               dnextents, id->ino, nextents);
                error++;
        }
-       if (anextents != be16_to_cpu(dip->di_anextents)) {
+       if (anextents != danextents) {
                if (v)
                        dbprintf(_("bad anextents %d for inode %lld, counted "
                                 "%d\n"),
-                               be16_to_cpu(dip->di_anextents), id->ino, anextents);
+                               danextents, id->ino, anextents);
                error++;
        }
        if (type == DBM_DIR)
index 34fe11481c7d4f03d03f37b4ad20e3dfc6821f73..4efc6ad07f87522d1b5d5879d7ee76145d891859 100644 (file)
--- a/db/frag.c
+++ b/db/frag.c
@@ -264,7 +264,7 @@ process_exinode(
        xfs_bmbt_rec_t          *rp;
 
        rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
-       process_bmbt_reclist(rp, XFS_DFORK_NEXTENTS(dip, whichfork), extmapp);
+       process_bmbt_reclist(rp, xfs_dfork_nextents(dip, whichfork), extmapp);
 }
 
 static void
@@ -275,7 +275,7 @@ process_fork(
        extmap_t                *extmap;
        xfs_extnum_t            nex;
 
-       nex = XFS_DFORK_NEXTENTS(dip, whichfork);
+       nex = xfs_dfork_nextents(dip, whichfork);
        if (!nex)
                return;
        extmap = extmap_alloc(nex);
index 8957ec5ef2b9c85a1e99e10ef733d9bb3306aeb6..7efc137bb7b90346ba9dd46d21a75740b62924d6 100644 (file)
@@ -275,7 +275,7 @@ inode_a_bmx_count(
                return 0;
        ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff));
        return dip->di_aformat == XFS_DINODE_FMT_EXTENTS ?
-               be16_to_cpu(dip->di_anextents) : 0;
+               xfs_dfork_attr_extents(dip) : 0;
 }
 
 static int
@@ -338,8 +338,7 @@ inode_a_size(
                asf = (struct xfs_attr_shortform *)XFS_DFORK_APTR(dip);
                return bitize(be16_to_cpu(asf->hdr.totsize));
        case XFS_DINODE_FMT_EXTENTS:
-               return (int)be16_to_cpu(dip->di_anextents) *
-                                                       bitsz(xfs_bmbt_rec_t);
+               return (int)xfs_dfork_attr_extents(dip) * bitsz(xfs_bmbt_rec_t);
        case XFS_DINODE_FMT_BTREE:
                return bitize((int)XFS_DFORK_ASIZE(dip, mp));
        default:
@@ -500,7 +499,7 @@ inode_u_bmx_count(
        dip = obj;
        ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff));
        return dip->di_format == XFS_DINODE_FMT_EXTENTS ?
-               be32_to_cpu(dip->di_nextents) : 0;
+               xfs_dfork_data_extents(dip) : 0;
 }
 
 static int
@@ -596,8 +595,7 @@ inode_u_size(
        case XFS_DINODE_FMT_LOCAL:
                return bitize((int)be64_to_cpu(dip->di_size));
        case XFS_DINODE_FMT_EXTENTS:
-               return (int)be32_to_cpu(dip->di_nextents) *
-                                               bitsz(xfs_bmbt_rec_t);
+               return (int)xfs_dfork_data_extents(dip) * bitsz(xfs_bmbt_rec_t);
        case XFS_DINODE_FMT_BTREE:
                return bitize((int)XFS_DFORK_DSIZE(dip, mp));
        case XFS_DINODE_FMT_UUID:
index f24963ba5c603ab06a12a39ffae8aaf6261ed3cd..999c68f7ecf31ac820899ee38d5256ce947e55b7 100644 (file)
@@ -2282,7 +2282,7 @@ process_exinode(
 
        whichfork = (itype == TYP_ATTR) ? XFS_ATTR_FORK : XFS_DATA_FORK;
 
-       nex = XFS_DFORK_NEXTENTS(dip, whichfork);
+       nex = xfs_dfork_nextents(dip, whichfork);
        used = nex * sizeof(xfs_bmbt_rec_t);
        if (nex < 0 || used > XFS_DFORK_SIZE(dip, mp, whichfork)) {
                if (show_warnings)
@@ -2351,7 +2351,7 @@ static void
 process_dev_inode(
        struct xfs_dinode               *dip)
 {
-       if (XFS_DFORK_NEXTENTS(dip, XFS_DATA_FORK)) {
+       if (xfs_dfork_data_extents(dip)) {
                if (show_warnings)
                        print_warning("inode %llu has unexpected extents",
                                      (unsigned long long)cur_ino);
index 66594853a88bb25417657c797d5f2ce972090034..b5e9256d6d328a86e7d57a6b67c473cc6ba6ddec 100644 (file)
@@ -924,10 +924,6 @@ enum xfs_dinode_fmt {
        ((w) == XFS_DATA_FORK ? \
                (dip)->di_format : \
                (dip)->di_aformat)
-#define XFS_DFORK_NEXTENTS(dip,w) \
-       ((w) == XFS_DATA_FORK ? \
-               be32_to_cpu((dip)->di_nextents) : \
-               be16_to_cpu((dip)->di_anextents))
 
 /*
  * For block and character special files the 32bit dev_t is stored at the
index 15b03d2144b66351e16c8c5909cfdfb7eca1ba84..eebcb2b6c15baa2e646dfdfc4d4995cc0569f3a3 100644 (file)
@@ -333,9 +333,11 @@ xfs_dinode_verify_fork(
        struct xfs_mount        *mp,
        int                     whichfork)
 {
-       xfs_extnum_t            di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
+       xfs_extnum_t            di_nextents;
        xfs_extnum_t            max_extents;
 
+       di_nextents = xfs_dfork_nextents(dip, whichfork);
+
        switch (XFS_DFORK_FORMAT(dip, whichfork)) {
        case XFS_DINODE_FMT_LOCAL:
                /*
@@ -402,6 +404,9 @@ xfs_dinode_verify(
        uint16_t                flags;
        uint64_t                flags2;
        uint64_t                di_size;
+       xfs_extnum_t            nextents;
+       xfs_extnum_t            naextents;
+       xfs_filblks_t           nblocks;
 
        if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC))
                return __this_address;
@@ -432,10 +437,12 @@ xfs_dinode_verify(
        if ((S_ISLNK(mode) || S_ISDIR(mode)) && di_size == 0)
                return __this_address;
 
+       nextents = xfs_dfork_data_extents(dip);
+       naextents = xfs_dfork_attr_extents(dip);
+       nblocks = be64_to_cpu(dip->di_nblocks);
+
        /* Fork checks carried over from xfs_iformat_fork */
-       if (mode &&
-           be32_to_cpu(dip->di_nextents) + be16_to_cpu(dip->di_anextents) >
-                       be64_to_cpu(dip->di_nblocks))
+       if (mode && nextents + naextents > nblocks)
                return __this_address;
 
        if (mode && XFS_DFORK_BOFF(dip) > mp->m_sb.sb_inodesize)
@@ -492,7 +499,7 @@ xfs_dinode_verify(
                default:
                        return __this_address;
                }
-               if (dip->di_anextents)
+               if (naextents)
                        return __this_address;
        }
 
index 4d908a7a6b254eaf8cb1057b5f8014a54beeaafe..0530c69848c2d5279618601709b001c0011c5f8a 100644 (file)
@@ -103,7 +103,7 @@ xfs_iformat_extents(
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
        int                     state = xfs_bmap_fork_to_state(whichfork);
-       xfs_extnum_t            nex = XFS_DFORK_NEXTENTS(dip, whichfork);
+       xfs_extnum_t            nex = xfs_dfork_nextents(dip, whichfork);
        int                     size = nex * sizeof(xfs_bmbt_rec_t);
        struct xfs_iext_cursor  icur;
        struct xfs_bmbt_rec     *dp;
@@ -228,7 +228,7 @@ xfs_iformat_data_fork(
         * depend on it.
         */
        ip->i_df.if_format = dip->di_format;
-       ip->i_df.if_nextents = be32_to_cpu(dip->di_nextents);
+       ip->i_df.if_nextents = xfs_dfork_data_extents(dip);
 
        switch (inode->i_mode & S_IFMT) {
        case S_IFIFO:
@@ -293,14 +293,14 @@ xfs_iformat_attr_fork(
        struct xfs_inode        *ip,
        struct xfs_dinode       *dip)
 {
+       xfs_extnum_t            naextents = xfs_dfork_attr_extents(dip);
        int                     error = 0;
 
        /*
         * Initialize the extent count early, as the per-format routines may
         * depend on it.
         */
-       ip->i_afp = xfs_ifork_alloc(dip->di_aformat,
-                               be16_to_cpu(dip->di_anextents));
+       ip->i_afp = xfs_ifork_alloc(dip->di_aformat, naextents);
 
        switch (ip->i_afp->if_format) {
        case XFS_DINODE_FMT_LOCAL:
index 2605f7ff8fc119a161c7f8465816f7ca6a0261dc..7ed2ecb51bca98ec61e6f264c26e2063b2e0e29a 100644 (file)
@@ -141,6 +141,38 @@ static inline xfs_extnum_t xfs_iext_max_nextents(int whichfork)
        return MAXAEXTNUM;
 }
 
+static inline xfs_extnum_t
+xfs_dfork_data_extents(
+       struct xfs_dinode       *dip)
+{
+       return be32_to_cpu(dip->di_nextents);
+}
+
+static inline xfs_extnum_t
+xfs_dfork_attr_extents(
+       struct xfs_dinode       *dip)
+{
+       return be16_to_cpu(dip->di_anextents);
+}
+
+static inline xfs_extnum_t
+xfs_dfork_nextents(
+       struct xfs_dinode       *dip,
+       int                     whichfork)
+{
+       switch (whichfork) {
+       case XFS_DATA_FORK:
+               return xfs_dfork_data_extents(dip);
+       case XFS_ATTR_FORK:
+               return xfs_dfork_attr_extents(dip);
+       default:
+               ASSERT(0);
+               break;
+       }
+
+       return 0;
+}
+
 struct xfs_ifork *xfs_ifork_alloc(enum xfs_dinode_fmt format,
                                xfs_extnum_t nextents);
 struct xfs_ifork *xfs_iext_state_to_fork(struct xfs_inode *ip, int state);
index 5fd31a18b50788f8033cb688c2b7988636c36983..2055d96eeb3bf7b5e0b767d7a14729eb717e1442 100644 (file)
@@ -1083,7 +1083,7 @@ process_longform_attr(
        bno = blkmap_get(blkmap, 0);
        if (bno == NULLFSBLOCK) {
                if (dip->di_aformat == XFS_DINODE_FMT_EXTENTS &&
-                               be16_to_cpu(dip->di_anextents) == 0)
+                               xfs_dfork_attr_extents(dip) == 0)
                        return(0); /* the kernel can handle this state */
                do_warn(
        _("block 0 of inode %" PRIu64 " attribute fork is missing\n"),
index 61d7d49f7eb53263315ba090413dfc52db474ee8..b03ff270af8f994eac6174e05ddb007f66affac4 100644 (file)
@@ -71,7 +71,7 @@ _("clearing inode %" PRIu64 " attributes\n"), ino_num);
                fprintf(stderr,
 _("would have cleared inode %" PRIu64 " attributes\n"), ino_num);
 
-       if (be16_to_cpu(dino->di_anextents) != 0)  {
+       if (xfs_dfork_attr_extents(dino) != 0)  {
                if (no_modify)
                        return(1);
                dino->di_anextents = cpu_to_be16(0);
@@ -944,7 +944,7 @@ process_exinode(
        lino = XFS_AGINO_TO_INO(mp, agno, ino);
        rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
        *tot = 0;
-       numrecs = XFS_DFORK_NEXTENTS(dip, whichfork);
+       numrecs = xfs_dfork_nextents(dip, whichfork);
 
        /*
         * We've already decided on the maximum number of extents on the inode,
@@ -1046,7 +1046,7 @@ _("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu6
        }
 
        rp = (xfs_bmbt_rec_t *)XFS_DFORK_DPTR(dino);
-       numrecs = be32_to_cpu(dino->di_nextents);
+       numrecs = xfs_dfork_data_extents(dino);
 
        /*
         * the max # of extents in a symlink inode is equal to the
@@ -1553,6 +1553,8 @@ process_check_sb_inodes(
        int                     *type,
        int                     *dirty)
 {
+       xfs_extnum_t            dnextents;
+
        if (lino == mp->m_sb.sb_rootino) {
                if (*type != XR_INO_DIR)  {
                        do_warn(_("root inode %" PRIu64 " has bad type 0x%x\n"),
@@ -1594,6 +1596,7 @@ process_check_sb_inodes(
                }
                return 0;
        }
+       dnextents = xfs_dfork_data_extents(dinoc);
        if (lino == mp->m_sb.sb_rsumino) {
                if (*type != XR_INO_RTSUM) {
                        do_warn(
@@ -1607,10 +1610,10 @@ _("realtime summary inode %" PRIu64 " has bad type 0x%x, "),
                                do_warn(_("would reset to regular file\n"));
                        }
                }
-               if (mp->m_sb.sb_rblocks == 0 && dinoc->di_nextents != 0)  {
+               if (mp->m_sb.sb_rblocks == 0 && dnextents != 0)  {
                        do_warn(
 _("bad # of extents (%u) for realtime summary inode %" PRIu64 "\n"),
-                               be32_to_cpu(dinoc->di_nextents), lino);
+                               dnextents, lino);
                        return 1;
                }
                return 0;
@@ -1628,10 +1631,10 @@ _("realtime bitmap inode %" PRIu64 " has bad type 0x%x, "),
                                do_warn(_("would reset to regular file\n"));
                        }
                }
-               if (mp->m_sb.sb_rblocks == 0 && dinoc->di_nextents != 0)  {
+               if (mp->m_sb.sb_rblocks == 0 && dnextents != 0)  {
                        do_warn(
 _("bad # of extents (%u) for realtime bitmap inode %" PRIu64 "\n"),
-                               be32_to_cpu(dinoc->di_nextents), lino);
+                               dnextents, lino);
                        return 1;
                }
                return 0;
@@ -1790,6 +1793,9 @@ process_inode_blocks_and_extents(
        xfs_ino_t               lino,
        int                     *dirty)
 {
+       xfs_extnum_t            dnextents;
+       xfs_extnum_t            danextents;
+
        if (nblocks != be64_to_cpu(dino->di_nblocks))  {
                if (!no_modify)  {
                        do_warn(
@@ -1812,20 +1818,18 @@ _("too many data fork extents (%" PRIu64 ") in inode %" PRIu64 "\n"),
                        nextents, lino);
                return 1;
        }
-       if (nextents != be32_to_cpu(dino->di_nextents))  {
+       dnextents = xfs_dfork_data_extents(dino);
+       if (nextents != dnextents)  {
                if (!no_modify)  {
                        do_warn(
 _("correcting nextents for inode %" PRIu64 ", was %d - counted %" PRIu64 "\n"),
-                               lino,
-                               be32_to_cpu(dino->di_nextents),
-                               nextents);
+                               lino, dnextents, nextents);
                        dino->di_nextents = cpu_to_be32(nextents);
                        *dirty = 1;
                } else  {
                        do_warn(
 _("bad nextents %d for inode %" PRIu64 ", would reset to %" PRIu64 "\n"),
-                               be32_to_cpu(dino->di_nextents),
-                               lino, nextents);
+                               dnextents, lino, nextents);
                }
        }
 
@@ -1835,19 +1839,18 @@ _("too many attr fork extents (%" PRIu64 ") in inode %" PRIu64 "\n"),
                        anextents, lino);
                return 1;
        }
-       if (anextents != be16_to_cpu(dino->di_anextents))  {
+       danextents = xfs_dfork_attr_extents(dino);
+       if (anextents != danextents)  {
                if (!no_modify)  {
                        do_warn(
 _("correcting anextents for inode %" PRIu64 ", was %d - counted %" PRIu64 "\n"),
-                               lino,
-                               be16_to_cpu(dino->di_anextents), anextents);
+                               lino, danextents, anextents);
                        dino->di_anextents = cpu_to_be16(anextents);
                        *dirty = 1;
                } else  {
                        do_warn(
 _("bad anextents %d for inode %" PRIu64 ", would reset to %" PRIu64 "\n"),
-                               be16_to_cpu(dino->di_anextents),
-                               lino, anextents);
+                               danextents, lino, anextents);
                }
        }
 
@@ -1889,7 +1892,7 @@ process_inode_data_fork(
         * uses negative values in memory. hence if we see negative numbers
         * here, trash it!
         */
-       nex = be32_to_cpu(dino->di_nextents);
+       nex = xfs_dfork_data_extents(dino);
        if (nex < 0)
                *nextents = 1;
        else
@@ -2010,7 +2013,7 @@ process_inode_attr_fork(
                return 0;
        }
 
-       *anextents = be16_to_cpu(dino->di_anextents);
+       *anextents = xfs_dfork_attr_extents(dino);
        if (*anextents > be64_to_cpu(dino->di_nblocks))
                *anextents = 1;
 
index 8c53f5ef8a79dc799cac6216c72cb1ea3c035c95..017750e9a92a037d7daaa0d740797900970a19bf 100644 (file)
@@ -393,7 +393,7 @@ pf_read_exinode(
        struct xfs_dinode       *dino)
 {
        pf_read_bmbt_reclist(args, (xfs_bmbt_rec_t *)XFS_DFORK_DPTR(dino),
-                       be32_to_cpu(dino->di_nextents));
+                       xfs_dfork_data_extents(dino));
 }
 
 static void