Thread (10 messages) 10 messages, 2 authors, 2018-01-04
STALE3114d

[PATCH 2/5] xfs_db: check should deal with cow staging events correctly

From: Darrick J. Wong <hidden>
Date: 2018-01-03 18:40:22
Subsystem: the rest · Maintainer: Linus Torvalds

From: Darrick J. Wong <redacted>

Teach xfs_check to record cow staging events correctly.  This means that
we strip off the high bit before using startblock.

Signed-off-by: Darrick J. Wong <redacted>
---
 db/check.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/db/check.c b/db/check.c
index 3afde02..2f8dee5 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 {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help