]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libxfs: make libxfs_readbuf_verify return an error code
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 1 Mar 2020 17:34:10 +0000 (12:34 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Sun, 1 Mar 2020 17:34:10 +0000 (12:34 -0500)
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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/libxfs_io.h
libxfs/rdwr.c
repair/prefetch.c

index 0370d685e21d70dacb140a36cdc3c32322534d2e..d96b5318eaad152ea63605bbbb2acff7163ba8e5 100644 (file)
@@ -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);
index bbec1135c4b77e424001b617e1c0b1c81559dc84..83c6142f219c917e34b0e742d8015a70296fc24e 100644 (file)
@@ -946,14 +946,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 *
index 122729322228917403649bbd3215c5760e26dcda..a3858f9abbd967aa539e77e9021ce74c7f5afae7 100644 (file)
@@ -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++) {