diff mbox series

[09/18] libxfs: make libxfs_readbufr stash the error value in b_error

Message ID 158216301140.602314.6904049540452018739.stgit@magnolia (mailing list archive)
State Superseded, archived
Headers show
Series xfsprogs: refactor buffer function names | expand

Commit Message

Darrick J. Wong Feb. 20, 2020, 1:43 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Make libxfs_readbufr stash the error value in b_error, which will make
the behavior consistent between regular and multi-mapping buffers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/rdwr.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Christoph Hellwig Feb. 21, 2020, 2:46 p.m. UTC | #1
On Wed, Feb 19, 2020 at 05:43:31PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Make libxfs_readbufr stash the error value in b_error, which will make
> the behavior consistent between regular and multi-mapping buffers.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 24c5eaf6..51f93c3e 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -940,6 +940,7 @@  libxfs_readbufr(struct xfs_buftarg *btp, xfs_daddr_t blkno, xfs_buf_t *bp,
 		pthread_self(), __FUNCTION__, bytes, error,
 		(long long)LIBXFS_BBTOOFF64(blkno), (long long)blkno, bp);
 #endif
+	bp->b_error = error;
 	return error;
 }
 
@@ -999,9 +1000,7 @@  libxfs_readbuf(
 	 * contents. *cough* xfs_da_node_buf_ops *cough*.
 	 */
 	error = libxfs_readbufr(btp, blkno, bp, len, flags);
-	if (error)
-		bp->b_error = error;
-	else
+	if (!error)
 		libxfs_readbuf_verify(bp, ops);
 	return bp;
 }