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, Christoph Hellwig <hch@lst.de>,
	Dave Chinner <dchinner@redhat.com>
Subject: [PATCH 3/5] xfs_db: clean up the salvage read callsites in set_cur()
Date: Mon, 06 Apr 2020 11:52:42 -0700	[thread overview]
Message-ID: <158619916259.469742.7875972212442996405.stgit@magnolia> (raw)
In-Reply-To: <158619914362.469742.7048317858423621957.stgit@magnolia>

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

Clean up the LIBXFS_READBUF_SALVAGE call sites in set_cur so that we
use the return value directly instead of scraping it out later.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
---
 db/io.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)


diff --git a/db/io.c b/db/io.c
index 384e4c0f..6628d061 100644
--- a/db/io.c
+++ b/db/io.c
@@ -516,6 +516,7 @@ set_cur(
 	xfs_ino_t	ino;
 	uint16_t	mode;
 	const struct xfs_buf_ops *ops = type ? type->bops : NULL;
+	int		error;
 
 	if (iocur_sp < 0) {
 		dbprintf(_("set_cur no stack element to set\n"));
@@ -542,20 +543,21 @@ set_cur(
 		if (!iocur_top->bbmap)
 			return;
 		memcpy(iocur_top->bbmap, bbmap, sizeof(struct bbmap));
-		libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b, bbmap->nmaps,
-				LIBXFS_READBUF_SALVAGE, &bp, ops);
+		error = -libxfs_buf_read_map(mp->m_ddev_targp, bbmap->b,
+				bbmap->nmaps, LIBXFS_READBUF_SALVAGE, &bp,
+				ops);
 	} else {
-		libxfs_buf_read(mp->m_ddev_targp, blknum, len,
+		error = -libxfs_buf_read(mp->m_ddev_targp, blknum, len,
 				LIBXFS_READBUF_SALVAGE, &bp, ops);
 		iocur_top->bbmap = NULL;
 	}
 
 	/*
-	 * Keep the buffer even if the verifier says it is corrupted.
-	 * We're a diagnostic tool, after all.
+	 * Salvage mode means that we still get a buffer even if the verifier
+	 * says the metadata is corrupt.  Therefore, the only errors we should
+	 * get are for IO errors or runtime errors.
 	 */
-	if (!bp || (bp->b_error && bp->b_error != -EFSCORRUPTED &&
-				   bp->b_error != -EFSBADCRC))
+	if (error)
 		return;
 	iocur_top->buf = bp->b_addr;
 	iocur_top->bp = bp;


  parent reply	other threads:[~2020-04-06 18:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 18:52 [PATCH 0/5] xfsprogs: rollup of various fixes for 5.6 Darrick J. Wong
2020-04-06 18:52 ` [PATCH 1/5] libxfs: don't barf in libxfs_bwrite on a null buffer ops name Darrick J. Wong
2020-04-06 22:06   ` Allison Collins
2020-04-09  7:43   ` Christoph Hellwig
2020-04-06 18:52 ` [PATCH 2/5] libxfs: check return value of device flush when closing device Darrick J. Wong
2020-04-06 22:06   ` Allison Collins
2020-04-09  7:43   ` Christoph Hellwig
2020-04-06 18:52 ` Darrick J. Wong [this message]
2020-04-06 22:07   ` [PATCH 3/5] xfs_db: clean up the salvage read callsites in set_cur() Allison Collins
2020-04-06 18:52 ` [PATCH 4/5] xfs_repair: fix dir_read_buf use of libxfs_da_read_buf Darrick J. Wong
2020-04-06 22:09   ` Allison Collins
2020-04-07 19:05   ` Eric Sandeen
2020-04-09  7:44   ` Christoph Hellwig
2020-04-06 18:52 ` [PATCH 5/5] xfs_scrub: fix type error in render_ino_from_handle Darrick J. Wong
2020-04-06 22:09   ` Allison Collins
2020-04-09  7:44   ` 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=158619916259.469742.7875972212442996405.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=hch@lst.de \
    --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.