xfs: rename XFS_REFC_COW_START to _COWFLAG
We've been (ab)using XFS_REFC_COW_START as both an integer quantity and
a bit flag, even though it's *only* a bit flag. Rename the variable to
reflect its nature and update the cast target since we're not supposed
to be comparing it to xfs_agblock_t now.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
diff --git a/db/check.c b/db/check.c
index 406b0d4..bb27ce5 100644
--- a/db/check.c
+++ b/db/check.c
@@ -4848,8 +4848,8 @@
char *msg;
agbno = be32_to_cpu(rp[i].rc_startblock);
- if (agbno & XFS_REFC_COW_START) {
- agbno &= ~XFS_REFC_COW_START;
+ if (agbno & XFS_REFC_COWFLAG) {
+ agbno &= ~XFS_REFC_COWFLAG;
msg = _(
"leftover CoW extent (%u/%u) len %u\n");
} else {
diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h
index 005dd65..2ce588f 100644
--- a/libxfs/xfs_format.h
+++ b/libxfs/xfs_format.h
@@ -1612,7 +1612,7 @@
* on the startblock. This speeds up mount time deletion of stale
* staging extents because they're all at the right side of the tree.
*/
-#define XFS_REFC_COW_START ((xfs_agblock_t)(1U << 31))
+#define XFS_REFC_COWFLAG ((uint32_t)(1U << 31))
#define REFCNTBT_COWFLAG_BITLEN 1
#define REFCNTBT_AGBLOCK_BITLEN 31
diff --git a/libxfs/xfs_refcount.c b/libxfs/xfs_refcount.c
index c05d632..e5e1f64 100644
--- a/libxfs/xfs_refcount.c
+++ b/libxfs/xfs_refcount.c
@@ -50,7 +50,7 @@
int *stat)
{
trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno,
- bno | (domain == XFS_RCDOM_COW ? XFS_REFC_COW_START : 0),
+ bno | (domain == XFS_RCDOM_COW ? XFS_REFC_COWFLAG : 0),
XFS_LOOKUP_LE);
cur->bc_rec.rc.rc_startblock = bno;
cur->bc_rec.rc.rc_blockcount = 0;
@@ -70,7 +70,7 @@
int *stat)
{
trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno,
- bno | (domain == XFS_RCDOM_COW ? XFS_REFC_COW_START : 0),
+ bno | (domain == XFS_RCDOM_COW ? XFS_REFC_COWFLAG : 0),
XFS_LOOKUP_GE);
cur->bc_rec.rc.rc_startblock = bno;
cur->bc_rec.rc.rc_blockcount = 0;
@@ -90,7 +90,7 @@
int *stat)
{
trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno,
- bno | (domain == XFS_RCDOM_COW ? XFS_REFC_COW_START : 0),
+ bno | (domain == XFS_RCDOM_COW ? XFS_REFC_COWFLAG : 0),
XFS_LOOKUP_LE);
cur->bc_rec.rc.rc_startblock = bno;
cur->bc_rec.rc.rc_blockcount = 0;
@@ -107,8 +107,8 @@
__u32 start;
start = be32_to_cpu(rec->refc.rc_startblock);
- if (start & XFS_REFC_COW_START) {
- start &= ~XFS_REFC_COW_START;
+ if (start & XFS_REFC_COWFLAG) {
+ start &= ~XFS_REFC_COWFLAG;
irec->rc_domain = XFS_RCDOM_COW;
} else {
irec->rc_domain = XFS_RCDOM_SHARED;
@@ -187,9 +187,9 @@
trace_xfs_refcount_update(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec);
- start = irec->rc_startblock & ~XFS_REFC_COW_START;
+ start = irec->rc_startblock & ~XFS_REFC_COWFLAG;
if (irec->rc_domain == XFS_RCDOM_COW)
- start |= XFS_REFC_COW_START;
+ start |= XFS_REFC_COWFLAG;
rec.refc.rc_startblock = cpu_to_be32(start);
rec.refc.rc_blockcount = cpu_to_be32(irec->rc_blockcount);
@@ -1734,7 +1734,7 @@
return -EFSCORRUPTED;
if (XFS_IS_CORRUPT(cur->bc_mp, !(rec->refc.rc_startblock &
- cpu_to_be32(XFS_REFC_COW_START))))
+ cpu_to_be32(XFS_REFC_COWFLAG))))
return -EFSCORRUPTED;
rr = kmem_alloc(sizeof(struct xfs_refcount_recovery), 0);
@@ -1761,7 +1761,7 @@
int error;
/* reflink filesystems mustn't have AGs larger than 2^31-1 blocks */
- BUILD_BUG_ON(XFS_MAX_CRC_AG_BLOCKS >= XFS_REFC_COW_START);
+ BUILD_BUG_ON(XFS_MAX_CRC_AG_BLOCKS >= XFS_REFC_COWFLAG);
if (mp->m_sb.sb_agblocks > XFS_MAX_CRC_AG_BLOCKS)
return -EOPNOTSUPP;
diff --git a/libxfs/xfs_refcount_btree.c b/libxfs/xfs_refcount_btree.c
index fb9c984..0baba15 100644
--- a/libxfs/xfs_refcount_btree.c
+++ b/libxfs/xfs_refcount_btree.c
@@ -165,9 +165,9 @@
* query functions (which set rc_domain == -1U), so we check that the
* domain is /not/ shared.
*/
- start = cur->bc_rec.rc.rc_startblock & ~XFS_REFC_COW_START;
+ start = cur->bc_rec.rc.rc_startblock & ~XFS_REFC_COWFLAG;
if (cur->bc_rec.rc.rc_domain != XFS_RCDOM_SHARED)
- start |= XFS_REFC_COW_START;
+ start |= XFS_REFC_COWFLAG;
return start;
}
diff --git a/repair/rmap.c b/repair/rmap.c
index 752bd82..30a276f 100644
--- a/repair/rmap.c
+++ b/repair/rmap.c
@@ -1433,7 +1433,7 @@
unsigned int start = tmp.rc_startblock;
if (tmp.rc_domain == XFS_RCDOM_COW)
- start |= XFS_REFC_COW_START;
+ start |= XFS_REFC_COWFLAG;
do_warn(
_("Incorrect reference count: saw (%u/%u) len %u nlinks %u; should be (%u/%u) len %u nlinks %u\n"),
diff --git a/repair/scan.c b/repair/scan.c
index b9a55cd..13476c2 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -1376,9 +1376,9 @@
len = be32_to_cpu(rp[i].rc_blockcount);
nr = be32_to_cpu(rp[i].rc_refcount);
- if (b & XFS_REFC_COW_START) {
+ if (b & XFS_REFC_COWFLAG) {
domain = XFS_RCDOM_COW;
- agb &= ~XFS_REFC_COW_START;
+ agb &= ~XFS_REFC_COWFLAG;
} else {
domain = XFS_RCDOM_SHARED;
}