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>
Subject: [PATCH 08/25] libxfs: make libxfs_readbuf_verify return an error code
Date: Mon, 24 Feb 2020 16:12:19 -0800	[thread overview]
Message-ID: <158258953956.451378.12584291966139198190.stgit@magnolia> (raw)
In-Reply-To: <158258948821.451378.9298492251721116455.stgit@magnolia>

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

Return the bp->b_error from libxfs_readbuf_verify instead of making
callers check it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 libxfs/libxfs_io.h |    3 +--
 libxfs/rdwr.c      |   10 +++++++---
 repair/prefetch.c  |    5 +++--
 3 files changed, 11 insertions(+), 7 deletions(-)


diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index 0370d685..d96b5318 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -206,8 +206,7 @@ libxfs_buf_read(
 
 #endif /* XFS_BUF_TRACING */
 
-extern void	libxfs_readbuf_verify(struct xfs_buf *bp,
-			const struct xfs_buf_ops *ops);
+int libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops);
 struct xfs_buf *libxfs_getsb(struct xfs_mount *mp);
 extern void	libxfs_bcache_purge(void);
 extern void	libxfs_bcache_free(void);
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 7100d4df..fb22c118 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -939,14 +939,18 @@ libxfs_readbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, xfs_buf_t *bp,
 	return error;
 }
 
-void
-libxfs_readbuf_verify(struct xfs_buf *bp, const struct xfs_buf_ops *ops)
+int
+libxfs_readbuf_verify(
+	struct xfs_buf		*bp,
+	const struct xfs_buf_ops *ops)
 {
 	if (!ops)
-		return;
+		return bp->b_error;
+
 	bp->b_ops = ops;
 	bp->b_ops->verify_read(bp);
 	bp->b_flags &= ~LIBXFS_B_UNCHECKED;
+	return bp->b_error;
 }
 
 static struct xfs_buf *
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 12272932..a3858f9a 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -400,9 +400,10 @@ pf_read_inode_dirs(
 	int			icnt = 0;
 	int			hasdir = 0;
 	int			isadir;
+	int			error;
 
-	libxfs_readbuf_verify(bp, &xfs_inode_buf_ops);
-	if (bp->b_error)
+	error = -libxfs_readbuf_verify(bp, &xfs_inode_buf_ops);
+	if (error)
 		return;
 
 	for (icnt = 0; icnt < (bp->b_bcount >> mp->m_sb.sb_inodelog); icnt++) {


  parent reply	other threads:[~2020-02-25  0:12 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  0:11 [PATCH v2 00/25] xfsprogs: refactor buffer function names Darrick J. Wong
2020-02-25  0:11 ` [PATCH 01/25] libxfs: open-code "exit on buffer read failure" in upper level callers Darrick J. Wong
2020-02-25 17:42   ` Christoph Hellwig
2020-02-25 18:40     ` Darrick J. Wong
2020-02-25 18:42       ` Christoph Hellwig
2020-02-25 19:19         ` Darrick J. Wong
2020-02-25 19:26   ` [PATCH v2 " Darrick J. Wong
2020-02-25  0:11 ` [PATCH 02/25] libxfs: remove LIBXFS_EXIT_ON_FAILURE Darrick J. Wong
2020-02-25 17:43   ` Christoph Hellwig
2020-02-25  0:11 ` [PATCH 03/25] libxfs: remove LIBXFS_B_EXIT Darrick J. Wong
2020-02-25 17:43   ` Christoph Hellwig
2020-02-25  0:11 ` [PATCH 04/25] libxfs: replace libxfs_putbuf with libxfs_buf_relse Darrick J. Wong
2020-02-25  0:12 ` [PATCH 05/25] libxfs: replace libxfs_getbuf with libxfs_buf_get Darrick J. Wong
2020-02-25  0:12 ` [PATCH 06/25] libxfs: replace libxfs_readbuf with libxfs_buf_read Darrick J. Wong
2020-02-25  0:12 ` [PATCH 07/25] libxfs: rename libxfs_writebufr to libxfs_bwrite Darrick J. Wong
2020-02-25 17:44   ` Christoph Hellwig
2020-02-25  0:12 ` Darrick J. Wong [this message]
2020-02-25  0:12 ` [PATCH 09/25] libxfs: make libxfs_readbufr stash the error value in b_error Darrick J. Wong
2020-02-25  0:12 ` [PATCH 10/25] libxfs: introduce libxfs_buf_read_uncached Darrick J. Wong
2020-02-25 17:44   ` Christoph Hellwig
2020-02-25  0:12 ` [PATCH 11/25] xfs_db: use uncached buffer reads to get the superblock Darrick J. Wong
2020-02-25 17:45   ` Christoph Hellwig
2020-02-25  0:12 ` [PATCH 12/25] xfs_copy: " Darrick J. Wong
2020-02-25 17:45   ` Christoph Hellwig
2020-02-25  0:12 ` [PATCH 13/25] libxfs: move log functions for convenience Darrick J. Wong
2020-02-25 17:47   ` Christoph Hellwig
2020-02-25 18:47     ` Darrick J. Wong
2020-02-25  0:12 ` [PATCH 14/25] libxfs: convert libxfs_log_clear to use uncached buffers Darrick J. Wong
2020-02-25 17:49   ` Christoph Hellwig
2020-02-25 18:48     ` Darrick J. Wong
2020-02-25  0:13 ` [PATCH 15/25] libxlog: use uncached buffers instead of open-coding them Darrick J. Wong
2020-02-25 17:50   ` Christoph Hellwig
2020-02-25  0:13 ` [PATCH 16/25] libxfs: use uncached buffers for initial mkfs writes Darrick J. Wong
2020-02-25  0:13 ` [PATCH 17/25] libxfs: straighten out libxfs_writebuf naming confusion Darrick J. Wong
2020-02-25 17:50   ` Christoph Hellwig
2020-02-25  0:13 ` [PATCH 18/25] libxfs: remove unused flags parameter to libxfs_buf_mark_dirty Darrick J. Wong
2020-02-25 17:51   ` Christoph Hellwig
2020-02-25 18:52     ` Darrick J. Wong
2020-02-25  0:13 ` [PATCH 19/25] libxfs: remove libxfs_writebuf_int Darrick J. Wong
2020-02-25  0:13 ` [PATCH 20/25] libxfs: remove dangerous casting between xfs_buf and cache_node Darrick J. Wong
2020-02-25 17:52   ` Christoph Hellwig
2020-02-25 18:52     ` Darrick J. Wong
2020-02-25  0:13 ` [PATCH 21/25] libxfs: remove dangerous casting between cache_node and xfs_buf Darrick J. Wong
2020-02-25 17:52   ` Christoph Hellwig
2020-02-25  0:13 ` [PATCH 22/25] libxfs: remove the libxfs_{get,put}bufr APIs Darrick J. Wong
2020-02-25 17:52   ` Christoph Hellwig
2020-02-25  0:13 ` [PATCH 23/25] libxfs: hide libxfs_getbuf_flags Darrick J. Wong
2020-02-25  0:14 ` [PATCH 24/25] libxfs: rename libxfs_readbuf_map to libxfs_buf_read_map Darrick J. Wong
2020-02-25  0:14 ` [PATCH 25/25] libxfs: rename libxfs_getbuf_map to libxfs_buf_get_map Darrick J. Wong

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=158258953956.451378.12584291966139198190.stgit@magnolia \
    --to=darrick.wong@oracle.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.