From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Cc: Eric Sandeen <sandeen@redhat.com>
Subject: [PATCH] xfs_db: clean up the salvage read callsites in set_cur()
Date: Tue, 24 Mar 2020 14:09:56 -0700 [thread overview]
Message-ID: <20200324210956.GS29339@magnolia> (raw)
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>
---
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;
next reply other threads:[~2020-03-24 21:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 21:09 Darrick J. Wong [this message]
2020-03-24 23:20 ` [PATCH] xfs_db: clean up the salvage read callsites in set_cur() Dave Chinner
2020-03-25 7:13 ` 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=20200324210956.GS29339@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).