]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: check should deal with cow staging extents correctly
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 4 Jan 2018 19:58:29 +0000 (13:58 -0600)
committerEric Sandeen <sandeen@redhat.com>
Thu, 4 Jan 2018 19:58:29 +0000 (13:58 -0600)
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>
db/check.c

index 3afde02845d129616d5bab9d2d66e05d5d04716c..2f8dee583e90cd5ba055e7b3162ddcac272ea18e 100644 (file)
@@ -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 {