aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-01-04 13:58:29 -0600
committerEric Sandeen <sandeen@redhat.com>2018-01-04 13:58:29 -0600
commitb638281fee0bf4edc6328629eddc60e47bef153c (patch)
treeea157c5dd81a61a5ba3a001544adadbad2acb6b3
parent1ad4d3babd3e832f2c638c68da00de9947fb116c (diff)
downloadxfsprogs-dev-b638281fee0bf4edc6328629eddc60e47bef153c.tar.gz
xfs_db: check should deal with cow staging extents correctly
Teach xfs_check to record cow staging extents correctly. This means that we strip off the high bit before using startblock. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--db/check.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/db/check.c b/db/check.c
index 3afde02845..2f8dee583e 100644
--- a/db/check.c
+++ b/db/check.c
@@ -4730,13 +4730,24 @@ scanfunc_refcnt(
lastblock = 0;
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
if (be32_to_cpu(rp[i].rc_refcount) == 1) {
- dbprintf(_(
- "leftover CoW extent (%u/%u) len %u\n"),
+ xfs_agblock_t agbno;
+ char *msg;
+
+ agbno = be32_to_cpu(rp[i].rc_startblock);
+ if (agbno >= XFS_REFC_COW_START) {
+ agbno -= XFS_REFC_COW_START;
+ msg = _(
+ "leftover CoW extent (%u/%u) len %u\n");
+ } else {
+ msg = _(
+ "leftover CoW extent at unexpected address (%u/%u) len %u\n");
+ }
+ dbprintf(msg,
seqno,
- be32_to_cpu(rp[i].rc_startblock),
+ agbno,
be32_to_cpu(rp[i].rc_blockcount));
set_dbmap(seqno,
- be32_to_cpu(rp[i].rc_startblock),
+ agbno,
be32_to_cpu(rp[i].rc_blockcount),
DBM_COWDATA, seqno, bno);
} else {