diff mbox

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

Message ID 151500481975.7713.14990901464976914162.stgit@magnolia (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong Jan. 3, 2018, 6:40 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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 <darrick.wong@oracle.com>
---
 db/check.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick J. Wong Jan. 4, 2018, 6:06 p.m. UTC | #1
On Wed, Jan 03, 2018 at 10:40:19AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> Subject: [PATCH 2/5] xfs_db: check should deal with cow staging events correctly

s/events/extents/

> Teach xfs_check to record cow staging events correctly.  This means that

s/events/extents/

> we strip off the high bit before using startblock.

high, indeed. :P

--D

> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  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 {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen Jan. 4, 2018, 6:12 p.m. UTC | #2
On 1/3/18 12:40 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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 <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  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 {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 {