]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively
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: 755c38ffe1a5937d8fa03419018f49f3a23fa9a7

A future commit will introduce a 64-bit on-disk data extent counter and a
32-bit on-disk attr extent counter. This commit promotes xfs_extnum_t and
xfs_aextnum_t to 64 and 32-bits in order to correctly handle in-core versions
of these quantities.

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>
libxfs/xfs_bmap.c
libxfs/xfs_inode_fork.c
libxfs/xfs_inode_fork.h
libxfs/xfs_types.h
repair/dinode.c
repair/scan.c

index 8eacf0ae7c6c7f280279434b7d8b4d03897afb0c..1459834677545295b21377a61ec892d0b9cde733 100644 (file)
@@ -76,7 +76,7 @@ xfs_bmap_compute_maxlevels(
        maxrootrecs = xfs_bmdr_maxrecs(sz, 0);
        minleafrecs = mp->m_bmap_dmnr[0];
        minnoderecs = mp->m_bmap_dmnr[1];
-       maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs;
+       maxblocks = howmany_64(maxleafents, minleafrecs);
        for (level = 1; maxblocks > 1; level++) {
                if (maxblocks <= maxrootrecs)
                        maxblocks = 1;
@@ -460,7 +460,7 @@ error0:
        if (bp_release)
                xfs_trans_brelse(NULL, bp);
 error_norelse:
-       xfs_warn(mp, "%s: BAD after btree leaves for %d extents",
+       xfs_warn(mp, "%s: BAD after btree leaves for %llu extents",
                __func__, i);
        xfs_err(mp, "%s: CORRUPTED BTREE OR SOMETHING", __func__);
        xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
index 0530c69848c2d5279618601709b001c0011c5f8a..26527602fbb92fe148b4abf4641d865b61a7e0db 100644 (file)
@@ -115,8 +115,8 @@ xfs_iformat_extents(
         * we just bail out rather than crash in kmem_alloc() or memcpy() below.
         */
        if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, mp, whichfork))) {
-               xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).",
-                       (unsigned long long) ip->i_ino, nex);
+               xfs_warn(ip->i_mount, "corrupt inode %llu ((a)extents = %llu).",
+                       ip->i_ino, nex);
                xfs_inode_verifier_error(ip, -EFSCORRUPTED,
                                "xfs_iformat_extents(1)", dip, sizeof(*dip),
                                __this_address);
index 7ed2ecb51bca98ec61e6f264c26e2063b2e0e29a..4a8b77d425df2cbfc877b70ad2301f4d0c876cdb 100644 (file)
@@ -21,9 +21,9 @@ struct xfs_ifork {
                void            *if_root;       /* extent tree root */
                char            *if_data;       /* inline file data */
        } if_u1;
+       xfs_extnum_t            if_nextents;    /* # of extents in this fork */
        short                   if_broot_bytes; /* bytes allocated for root */
        int8_t                  if_format;      /* format of this fork */
-       xfs_extnum_t            if_nextents;    /* # of extents in this fork */
 };
 
 /*
index 794a54cbd0de1dffcfd0279254123d1a90f42823..373f64a492a4feb044a67880aefa26bfad271a27 100644 (file)
@@ -12,8 +12,8 @@ typedef uint32_t      xfs_agblock_t;  /* blockno in alloc. group */
 typedef uint32_t       xfs_agino_t;    /* inode # within allocation grp */
 typedef uint32_t       xfs_extlen_t;   /* extent length in blocks */
 typedef uint32_t       xfs_agnumber_t; /* allocation group number */
-typedef int32_t                xfs_extnum_t;   /* # of extents in a file */
-typedef int16_t                xfs_aextnum_t;  /* # extents in an attribute fork */
+typedef uint64_t       xfs_extnum_t;   /* # of extents in a file */
+typedef uint32_t       xfs_aextnum_t;  /* # extents in an attribute fork */
 typedef int64_t                xfs_fsize_t;    /* bytes in a file */
 typedef uint64_t       xfs_ufsize_t;   /* unsigned bytes in a file */
 
index b03ff270af8f994eac6174e05ddb007f66affac4..28343083c539c0ebe5ad6a1a394aaac7bc16dbb8 100644 (file)
@@ -388,9 +388,9 @@ process_bmbt_reclist_int(
                        *last_key = irec.br_startoff;
                if (i > 0 && op + cp > irec.br_startoff)  {
                        do_warn(
-_("bmap rec out of order, inode %" PRIu64" entry %d "
+_("bmap rec out of order, inode %" PRIu64" entry %" PRIu64 " "
   "[o s c] [%" PRIu64 " %" PRIu64 " %" PRIu64 "], "
-  "%d [%" PRIu64 " %" PRIu64 " %" PRIu64 "]\n"),
+  "%" PRIu64 " [%" PRIu64 " %" PRIu64 " %" PRIu64 "]\n"),
                                ino, i, irec.br_startoff, irec.br_startblock,
                                irec.br_blockcount, i - 1, op, sp, cp);
                        goto done;
@@ -1054,7 +1054,7 @@ _("mismatch between format (%d) and size (%" PRId64 ") in symlink inode %" PRIu6
         */
        if (numrecs > max_symlink_blocks)  {
                do_warn(
-_("bad number of extents (%d) in symlink %" PRIu64 " data fork\n"),
+_("bad number of extents (%" PRIu64 ") in symlink %" PRIu64 " data fork\n"),
                        numrecs, lino);
                return(1);
        }
@@ -1066,13 +1066,13 @@ _("bad number of extents (%d) in symlink %" PRIu64 " data fork\n"),
                libxfs_bmbt_disk_get_all((rp +i), &irec);
                if (irec.br_startoff != expected_offset)  {
                        do_warn(
-_("bad extent #%d offset (%" PRIu64 ") in symlink %" PRIu64 " data fork\n"),
+_("bad extent #%" PRIu64 " offset (%" PRIu64 ") in symlink %" PRIu64 " data fork\n"),
                                i, irec.br_startoff, lino);
                        return(1);
                }
                if (irec.br_blockcount == 0 || irec.br_blockcount > max_blocks) {
                        do_warn(
-_("bad extent #%d count (%" PRIu64 ") in symlink %" PRIu64 " data fork\n"),
+_("bad extent #%" PRIu64 " count (%" PRIu64 ") in symlink %" PRIu64 " data fork\n"),
                                i, irec.br_blockcount, lino);
                        return(1);
                }
@@ -1612,7 +1612,7 @@ _("realtime summary inode %" PRIu64 " has bad type 0x%x, "),
                }
                if (mp->m_sb.sb_rblocks == 0 && dnextents != 0)  {
                        do_warn(
-_("bad # of extents (%u) for realtime summary inode %" PRIu64 "\n"),
+_("bad # of extents (%" PRIu64 ") for realtime summary inode %" PRIu64 "\n"),
                                dnextents, lino);
                        return 1;
                }
@@ -1633,7 +1633,7 @@ _("realtime bitmap inode %" PRIu64 " has bad type 0x%x, "),
                }
                if (mp->m_sb.sb_rblocks == 0 && dnextents != 0)  {
                        do_warn(
-_("bad # of extents (%u) for realtime bitmap inode %" PRIu64 "\n"),
+_("bad # of extents (%" PRIu64 ") for realtime bitmap inode %" PRIu64 "\n"),
                                dnextents, lino);
                        return 1;
                }
@@ -1822,13 +1822,13 @@ _("too many data fork extents (%" PRIu64 ") in inode %" PRIu64 "\n"),
        if (nextents != dnextents)  {
                if (!no_modify)  {
                        do_warn(
-_("correcting nextents for inode %" PRIu64 ", was %d - counted %" PRIu64 "\n"),
+_("correcting nextents for inode %" PRIu64 ", was %" PRIu64 " - counted %" PRIu64 "\n"),
                                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"),
+_("bad nextents %" PRIu64 " for inode %" PRIu64 ", would reset to %" PRIu64 "\n"),
                                dnextents, lino, nextents);
                }
        }
@@ -1843,13 +1843,13 @@ _("too many attr fork extents (%" PRIu64 ") in inode %" PRIu64 "\n"),
        if (anextents != danextents)  {
                if (!no_modify)  {
                        do_warn(
-_("correcting anextents for inode %" PRIu64 ", was %d - counted %" PRIu64 "\n"),
+_("correcting anextents for inode %" PRIu64 ", was %" PRIu64 " - counted %" PRIu64 "\n"),
                                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"),
+_("bad anextents %" PRIu64 " for inode %" PRIu64 ", would reset to %" PRIu64 "\n"),
                                danextents, lino, anextents);
                }
        }
index 97ae5ae843833249343ca778548d04be22346414..020fb02f34f3580be05534d0e8969d5ea3e26ad1 100644 (file)
@@ -425,7 +425,7 @@ _("couldn't add inode %"PRIu64" bmbt block %"PRIu64" reverse-mapping data."),
                if (numrecs > mp->m_bmap_dmxr[0] || (isroot == 0 && numrecs <
                                                        mp->m_bmap_dmnr[0])) {
                                do_warn(
-_("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
+_("inode %" PRIu64 " bad # of bmap records (%" PRIu64 ", min - %u, max - %u)\n"),
                                        ino, numrecs, mp->m_bmap_dmnr[0],
                                        mp->m_bmap_dmxr[0]);
                        return(1);
@@ -476,7 +476,7 @@ _("out-of-order bmap key (file offset) in inode %" PRIu64 ", %s fork, fsbno %" P
        if (numrecs > mp->m_bmap_dmxr[1] || (isroot == 0 && numrecs <
                                                        mp->m_bmap_dmnr[1])) {
                do_warn(
-_("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
+_("inode %" PRIu64 " bad # of bmap records (%" PRIu64 ", min - %u, max - %u)\n"),
                        ino, numrecs, mp->m_bmap_dmnr[1], mp->m_bmap_dmxr[1]);
                return(1);
        }