All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 11/16] xfs_repair: remove verify_dfsbno
Date: Sat, 09 May 2020 09:31:07 -0700	[thread overview]
Message-ID: <158904186786.982941.13402008407746781785.stgit@magnolia> (raw)
In-Reply-To: <158904179213.982941.9666913277909349291.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Replace this homegrown helper with its libxfs equivalent.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/attr_repair.c |    2 +-
 repair/dinode.c      |   21 +--------------------
 repair/dinode.h      |    4 ----
 repair/prefetch.c    |    9 +++++----
 repair/scan.c        |    2 +-
 5 files changed, 8 insertions(+), 30 deletions(-)


diff --git a/repair/attr_repair.c b/repair/attr_repair.c
index 5f884033..6cec0f70 100644
--- a/repair/attr_repair.c
+++ b/repair/attr_repair.c
@@ -1092,7 +1092,7 @@ process_longform_attr(
 	}
 
 	/* FIX FOR bug 653709 -- EKN */
-	if (!xfs_verify_fsbno(mp, bno)) {
+	if (!libxfs_verify_fsbno(mp, bno)) {
 		do_warn(
 	_("block in attribute fork of inode %" PRIu64 " is not valid\n"), ino);
 		return 1;
diff --git a/repair/dinode.c b/repair/dinode.c
index 135703d9..67adddd7 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -203,25 +203,6 @@ verify_aginum(xfs_mount_t	*mp,
 	return verify_ag_bno(sbp, agno, agbno);
 }
 
-/*
- * return 1 if block number is good, 0 if out of range
- */
-int
-verify_dfsbno(xfs_mount_t	*mp,
-		xfs_fsblock_t	fsbno)
-{
-	xfs_agnumber_t	agno;
-	xfs_agblock_t	agbno;
-	xfs_sb_t	*sbp = &mp->m_sb;;
-
-	/* range check ag #, ag block.  range-checking offset is pointless */
-
-	agno = XFS_FSB_TO_AGNO(mp, fsbno);
-	agbno = XFS_FSB_TO_AGBNO(mp, fsbno);
-
-	return verify_ag_bno(sbp, agno, agbno) == 0;
-}
-
 #define XR_DFSBNORANGE_VALID	0
 #define XR_DFSBNORANGE_BADSTART	1
 #define XR_DFSBNORANGE_BADEND	2
@@ -835,7 +816,7 @@ _("bad numrecs 0 in inode %" PRIu64 " bmap btree root block\n"),
 		 * btree, we'd do it right here.  For now, if there's a
 		 * problem, we'll bail out and presumably clear the inode.
 		 */
-		if (!verify_dfsbno(mp, get_unaligned_be64(&pp[i])))  {
+		if (!libxfs_verify_fsbno(mp, get_unaligned_be64(&pp[i])))  {
 			do_warn(
 _("bad bmap btree ptr 0x%" PRIx64 " in ino %" PRIu64 "\n"),
 				get_unaligned_be64(&pp[i]), lino);
diff --git a/repair/dinode.h b/repair/dinode.h
index c8e563b5..4bf7affd 100644
--- a/repair/dinode.h
+++ b/repair/dinode.h
@@ -9,10 +9,6 @@
 struct blkmap;
 struct prefetch_args;
 
-int
-verify_dfsbno(xfs_mount_t	*mp,
-		xfs_fsblock_t	fsbno);
-
 void
 convert_extent(
 	xfs_bmbt_rec_t		*rp,
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 3ac49db1..686bf7be 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -188,8 +188,9 @@ pf_read_bmbt_reclist(
 				(irec.br_startoff >= fs_max_file_offset))
 			goto out_free;
 
-		if (!verify_dfsbno(mp, irec.br_startblock) || !verify_dfsbno(mp,
-				irec.br_startblock + irec.br_blockcount - 1))
+		if (!libxfs_verify_fsbno(mp, irec.br_startblock) ||
+		    !libxfs_verify_fsbno(mp, irec.br_startblock +
+					     irec.br_blockcount - 1))
 			goto out_free;
 
 		if (!args->dirs_only && ((irec.br_startoff +
@@ -337,7 +338,7 @@ pf_scanfunc_bmap(
 
 	for (i = 0; i < numrecs; i++) {
 		dbno = get_unaligned_be64(&pp[i]);
-		if (!verify_dfsbno(mp, dbno))
+		if (!libxfs_verify_fsbno(mp, dbno))
 			return 0;
 		if (!pf_scan_lbtree(dbno, level, isadir, args, pf_scanfunc_bmap))
 			return 0;
@@ -379,7 +380,7 @@ pf_read_btinode(
 
 	for (i = 0; i < numrecs; i++) {
 		dbno = get_unaligned_be64(&pp[i]);
-		if (!verify_dfsbno(mp, dbno))
+		if (!libxfs_verify_fsbno(mp, dbno))
 			break;
 		if (!pf_scan_lbtree(dbno, level, isadir, args, pf_scanfunc_bmap))
 			break;
diff --git a/repair/scan.c b/repair/scan.c
index 8e81c552..dcd4864d 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -491,7 +491,7 @@ _("inode %" PRIu64 " bad # of bmap records (%u, min - %u, max - %u)\n"),
 		 * we'd do it right here.  For now, if there's a problem,
 		 * we'll bail out and presumably clear the inode.
 		 */
-		if (!verify_dfsbno(mp, be64_to_cpu(pp[i])))  {
+		if (!libxfs_verify_fsbno(mp, be64_to_cpu(pp[i])))  {
 			do_warn(
 _("bad bmap btree ptr 0x%llx in ino %" PRIu64 "\n"),
 			       (unsigned long long) be64_to_cpu(pp[i]), ino);


  parent reply	other threads:[~2020-05-09 16:31 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 16:29 [PATCH 00/16] xfs_repair: catch things that xfs_check misses Darrick J. Wong
2020-05-09 16:29 ` [PATCH 01/16] xfs_repair: fix missing dir buffer corruption checks Darrick J. Wong
2020-05-09 17:08   ` Christoph Hellwig
2020-05-11 16:44     ` Darrick J. Wong
2020-05-11 17:36       ` Darrick J. Wong
2020-05-12 17:29   ` [PATCH v2 " Darrick J. Wong
2020-05-13  6:22     ` Christoph Hellwig
2020-05-13 15:35       ` Darrick J. Wong
2020-05-09 16:30 ` [PATCH 02/16] xfs_repair: warn when we would have rebuilt a directory Darrick J. Wong
2020-05-09 17:09   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 03/16] xfs_repair: check for AG btree records that would wrap around Darrick J. Wong
2020-05-09 17:09   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 04/16] xfs_repair: fix bnobt and refcountbt record order checks Darrick J. Wong
2020-05-09 17:10   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 05/16] xfs_repair: check for out-of-order inobt records Darrick J. Wong
2020-05-09 17:11   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 06/16] xfs_repair: fix rmapbt record order check Darrick J. Wong
2020-05-10  7:33   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 07/16] xfs_repair: tag inobt vs finobt errors properly Darrick J. Wong
2020-05-09 17:14   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 08/16] xfs_repair: complain about bad interior btree pointers Darrick J. Wong
2020-05-09 17:15   ` Christoph Hellwig
2020-05-09 16:30 ` [PATCH 09/16] xfs_repair: convert to libxfs_verify_agbno Darrick J. Wong
2020-05-09 17:18   ` Christoph Hellwig
2020-05-11 16:22     ` Darrick J. Wong
2020-05-12  8:07       ` Christoph Hellwig
2020-05-09 16:31 ` [PATCH 10/16] xfs_repair: refactor verify_dfsbno_range Darrick J. Wong
2020-05-10  7:24   ` Christoph Hellwig
2020-05-09 16:31 ` Darrick J. Wong [this message]
2020-05-10  7:24   ` [PATCH 11/16] xfs_repair: remove verify_dfsbno Christoph Hellwig
2020-05-09 16:31 ` [PATCH 12/16] xfs_repair: remove verify_aginum Darrick J. Wong
2020-05-10  7:25   ` Christoph Hellwig
2020-05-09 16:31 ` [PATCH 13/16] xfs_repair: mark entire free space btree record as free1 Darrick J. Wong
2020-05-10  7:26   ` Christoph Hellwig
2020-05-09 16:31 ` [PATCH 14/16] xfs_repair: complain about free space only seen by one btree Darrick J. Wong
2020-05-10  7:26   ` Christoph Hellwig
2020-05-09 16:31 ` [PATCH 15/16] xfs_repair: complain about extents in unknown state Darrick J. Wong
2020-05-10  7:27   ` Christoph Hellwig
2020-05-09 16:31 ` [PATCH 16/16] xfs_repair: complain about any nonzero inprogress value, not just 1 Darrick J. Wong
2020-05-10  7:27   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=158904186786.982941.13402008407746781785.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.