]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: namespace the maximum length/refcount symbols
authorDarrick J. Wong <djwong@kernel.org>
Mon, 12 Aug 2024 21:19:16 +0000 (14:19 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 14 Aug 2024 03:08:22 +0000 (20:08 -0700)
Actually namespace these variables properly, so that readers can tell
that this is an XFS symbol, and that it's for the refcount
functionality.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_format.h
libxfs/xfs_refcount.c
repair/rmap.c
repair/scan.c

index cedb0c1d477d36182b0ed7f6656177589d7b43a8..ea55115e024beb41357465d5366827532908af62 100644 (file)
@@ -1788,8 +1788,8 @@ struct xfs_refcount_key {
        __be32          rc_startblock;  /* starting block number */
 };
 
-#define MAXREFCOUNT    ((xfs_nlink_t)~0U)
-#define MAXREFCEXTLEN  ((xfs_extlen_t)~0U)
+#define XFS_REFC_REFCOUNT_MAX  ((xfs_nlink_t)~0U)
+#define XFS_REFC_LEN_MAX       ((xfs_extlen_t)~0U)
 
 /* btree pointer type */
 typedef __be32 xfs_refcount_ptr_t;
index 9ea93f391731207c9c8e6ff4d691ae7a0dffbcb4..5b09e29c20aa12bb0c54a4b6346f317e20d064d0 100644 (file)
@@ -127,7 +127,7 @@ xfs_refcount_check_irec(
        struct xfs_perag                *pag,
        const struct xfs_refcount_irec  *irec)
 {
-       if (irec->rc_blockcount == 0 || irec->rc_blockcount > MAXREFCEXTLEN)
+       if (irec->rc_blockcount == 0 || irec->rc_blockcount > XFS_REFC_LEN_MAX)
                return __this_address;
 
        if (!xfs_refcount_check_domain(irec))
@@ -137,7 +137,7 @@ xfs_refcount_check_irec(
        if (!xfs_verify_agbext(pag, irec->rc_startblock, irec->rc_blockcount))
                return __this_address;
 
-       if (irec->rc_refcount == 0 || irec->rc_refcount > MAXREFCOUNT)
+       if (irec->rc_refcount == 0 || irec->rc_refcount > XFS_REFC_REFCOUNT_MAX)
                return __this_address;
 
        return NULL;
@@ -852,9 +852,9 @@ xfs_refc_merge_refcount(
        const struct xfs_refcount_irec  *irec,
        enum xfs_refc_adjust_op         adjust)
 {
-       /* Once a record hits MAXREFCOUNT, it is pinned there forever */
-       if (irec->rc_refcount == MAXREFCOUNT)
-               return MAXREFCOUNT;
+       /* Once a record hits XFS_REFC_REFCOUNT_MAX, it is pinned forever */
+       if (irec->rc_refcount == XFS_REFC_REFCOUNT_MAX)
+               return XFS_REFC_REFCOUNT_MAX;
        return irec->rc_refcount + adjust;
 }
 
@@ -897,7 +897,7 @@ xfs_refc_want_merge_center(
         * hence we need to catch u32 addition overflows here.
         */
        ulen += cleft->rc_blockcount + right->rc_blockcount;
-       if (ulen >= MAXREFCEXTLEN)
+       if (ulen >= XFS_REFC_LEN_MAX)
                return false;
 
        *ulenp = ulen;
@@ -932,7 +932,7 @@ xfs_refc_want_merge_left(
         * hence we need to catch u32 addition overflows here.
         */
        ulen += cleft->rc_blockcount;
-       if (ulen >= MAXREFCEXTLEN)
+       if (ulen >= XFS_REFC_LEN_MAX)
                return false;
 
        return true;
@@ -966,7 +966,7 @@ xfs_refc_want_merge_right(
         * hence we need to catch u32 addition overflows here.
         */
        ulen += cright->rc_blockcount;
-       if (ulen >= MAXREFCEXTLEN)
+       if (ulen >= XFS_REFC_LEN_MAX)
                return false;
 
        return true;
@@ -1196,7 +1196,7 @@ xfs_refcount_adjust_extents(
                 * Adjust the reference count and either update the tree
                 * (incr) or free the blocks (decr).
                 */
-               if (ext.rc_refcount == MAXREFCOUNT)
+               if (ext.rc_refcount == XFS_REFC_REFCOUNT_MAX)
                        goto skip;
                ext.rc_refcount += adj;
                trace_xfs_refcount_modify_extent(cur, &ext);
index d48975b137b42174085805facedf5e69d577ccae..1e5dd99dabf1085745dcc6de6aacf53398bbb65b 100644 (file)
@@ -894,7 +894,7 @@ refcount_emit(
                agno, agbno, len, nr_rmaps);
        rlrec.rc_startblock = agbno;
        rlrec.rc_blockcount = len;
-       nr_rmaps = min(nr_rmaps, MAXREFCOUNT);
+       nr_rmaps = min(nr_rmaps, XFS_REFC_REFCOUNT_MAX);
        rlrec.rc_refcount = nr_rmaps;
        rlrec.rc_domain = XFS_REFC_DOMAIN_SHARED;
 
index 60dc6354d8334c08581d4ff58ead897234395e82..5800201b4a0c30091100a4c165dc2afe0796e9ff 100644 (file)
@@ -1884,7 +1884,7 @@ _("extent (%u/%u) len %u claimed, state is %d\n"),
                                                break;
                                        }
                                }
-                       } else if (nr < 2 || nr > MAXREFCOUNT) {
+                       } else if (nr < 2 || nr > XFS_REFC_REFCOUNT_MAX) {
                                do_warn(
        _("invalid reference count %u in record %u of %s btree block %u/%u\n"),
                                        nr, i, name, agno, bno);