]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: namespace the maximum length/refcount symbols
authorDarrick J. Wong <djwong@kernel.org>
Tue, 15 Oct 2024 19:40:12 +0000 (12:40 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:36:28 +0000 (13:36 -0800)
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>
fs/xfs/libxfs/xfs_format.h
fs/xfs/libxfs/xfs_refcount.c
fs/xfs/scrub/refcount.c
fs/xfs/scrub/refcount_repair.c

index 7cb0293f01f63abbc0b427e3e9246f838d38415c..a38ea391d3eb583d321a5f72a43ac695bc356a25 100644 (file)
@@ -1790,8 +1790,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 bbb86dc9a25c7f58fa56f5bce78a8ee7a80672eb..faace12fe2e3838e5272bfe04feb3ba1334217eb 100644 (file)
@@ -128,7 +128,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))
@@ -138,7 +138,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;
@@ -853,9 +853,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;
 }
 
@@ -898,7 +898,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;
@@ -933,7 +933,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;
@@ -967,7 +967,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 2b6be75e94241515f573e6caf77e3ef88bebd88a..2c021ed231212ca904f77a39d4cc7547c980c33e 100644 (file)
@@ -421,7 +421,7 @@ xchk_refcount_mergeable(
        if (r1->rc_refcount != r2->rc_refcount)
                return false;
        if ((unsigned long long)r1->rc_blockcount + r2->rc_blockcount >
-                       MAXREFCEXTLEN)
+                       XFS_REFC_LEN_MAX)
                return false;
 
        return true;
index 4e572b81c98669e38ee349fc32f06058d197c0d9..1ee6d4aeb308f59c170831ee5b69ede22b7d2d5c 100644 (file)
@@ -183,7 +183,7 @@ xrep_refc_stash(
        if (xchk_should_terminate(sc, &error))
                return error;
 
-       irec.rc_refcount = min_t(uint64_t, MAXREFCOUNT, refcount);
+       irec.rc_refcount = min_t(uint64_t, XFS_REFC_REFCOUNT_MAX, refcount);
 
        error = xrep_refc_check_ext(rr->sc, &irec);
        if (error)
@@ -422,7 +422,7 @@ xrep_refc_find_refcounts(
        /*
         * Set up a bag to store all the rmap records that we're tracking to
         * generate a reference count record.  If the size of the bag exceeds
-        * MAXREFCOUNT, we clamp rc_refcount.
+        * XFS_REFC_REFCOUNT_MAX, we clamp rc_refcount.
         */
        error = rcbag_init(sc->mp, sc->xmbtp, &rcstack);
        if (error)