xfs: make xfs_trans_get_buf_map return an error code
Convert xfs_trans_get_buf_map() to return numeric error codes like most everywhere else in xfs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
0e3eccce5e
commit
9676b54e6e
|
@ -2591,13 +2591,9 @@ xfs_da_get_buf(
|
||||||
if (error || nmap == 0)
|
if (error || nmap == 0)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
bp = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0);
|
error = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0, &bp);
|
||||||
error = bp ? bp->b_error : -EIO;
|
if (error)
|
||||||
if (error) {
|
|
||||||
if (bp)
|
|
||||||
xfs_trans_brelse(tp, bp);
|
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
|
||||||
|
|
||||||
*bpp = bp;
|
*bpp = bp;
|
||||||
|
|
||||||
|
|
|
@ -169,10 +169,9 @@ int xfs_trans_alloc_empty(struct xfs_mount *mp,
|
||||||
struct xfs_trans **tpp);
|
struct xfs_trans **tpp);
|
||||||
void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
|
void xfs_trans_mod_sb(xfs_trans_t *, uint, int64_t);
|
||||||
|
|
||||||
struct xfs_buf *xfs_trans_get_buf_map(struct xfs_trans *tp,
|
int xfs_trans_get_buf_map(struct xfs_trans *tp, struct xfs_buftarg *target,
|
||||||
struct xfs_buftarg *target,
|
struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags,
|
||||||
struct xfs_buf_map *map, int nmaps,
|
struct xfs_buf **bpp);
|
||||||
uint flags);
|
|
||||||
|
|
||||||
static inline struct xfs_buf *
|
static inline struct xfs_buf *
|
||||||
xfs_trans_get_buf(
|
xfs_trans_get_buf(
|
||||||
|
@ -182,8 +181,14 @@ xfs_trans_get_buf(
|
||||||
int numblks,
|
int numblks,
|
||||||
uint flags)
|
uint flags)
|
||||||
{
|
{
|
||||||
|
struct xfs_buf *bp;
|
||||||
|
int error;
|
||||||
|
|
||||||
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
|
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
|
||||||
return xfs_trans_get_buf_map(tp, target, &map, 1, flags);
|
error = xfs_trans_get_buf_map(tp, target, &map, 1, flags, &bp);
|
||||||
|
if (error)
|
||||||
|
return NULL;
|
||||||
|
return bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xfs_trans_read_buf_map(struct xfs_mount *mp,
|
int xfs_trans_read_buf_map(struct xfs_mount *mp,
|
||||||
|
|
|
@ -112,24 +112,22 @@ xfs_trans_bjoin(
|
||||||
* If the transaction pointer is NULL, make this just a normal
|
* If the transaction pointer is NULL, make this just a normal
|
||||||
* get_buf() call.
|
* get_buf() call.
|
||||||
*/
|
*/
|
||||||
struct xfs_buf *
|
int
|
||||||
xfs_trans_get_buf_map(
|
xfs_trans_get_buf_map(
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
struct xfs_buftarg *target,
|
struct xfs_buftarg *target,
|
||||||
struct xfs_buf_map *map,
|
struct xfs_buf_map *map,
|
||||||
int nmaps,
|
int nmaps,
|
||||||
xfs_buf_flags_t flags)
|
xfs_buf_flags_t flags,
|
||||||
|
struct xfs_buf **bpp)
|
||||||
{
|
{
|
||||||
xfs_buf_t *bp;
|
xfs_buf_t *bp;
|
||||||
struct xfs_buf_log_item *bip;
|
struct xfs_buf_log_item *bip;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (!tp) {
|
*bpp = NULL;
|
||||||
error = xfs_buf_get_map(target, map, nmaps, flags, &bp);
|
if (!tp)
|
||||||
if (error)
|
return xfs_buf_get_map(target, map, nmaps, flags, bpp);
|
||||||
return NULL;
|
|
||||||
return bp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we find the buffer in the cache with this transaction
|
* If we find the buffer in the cache with this transaction
|
||||||
|
@ -151,18 +149,20 @@ xfs_trans_get_buf_map(
|
||||||
ASSERT(atomic_read(&bip->bli_refcount) > 0);
|
ASSERT(atomic_read(&bip->bli_refcount) > 0);
|
||||||
bip->bli_recur++;
|
bip->bli_recur++;
|
||||||
trace_xfs_trans_get_buf_recur(bip);
|
trace_xfs_trans_get_buf_recur(bip);
|
||||||
return bp;
|
*bpp = bp;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = xfs_buf_get_map(target, map, nmaps, flags, &bp);
|
error = xfs_buf_get_map(target, map, nmaps, flags, &bp);
|
||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return error;
|
||||||
|
|
||||||
ASSERT(!bp->b_error);
|
ASSERT(!bp->b_error);
|
||||||
|
|
||||||
_xfs_trans_bjoin(tp, bp, 1);
|
_xfs_trans_bjoin(tp, bp, 1);
|
||||||
trace_xfs_trans_get_buf(bp->b_log_item);
|
trace_xfs_trans_get_buf(bp->b_log_item);
|
||||||
return bp;
|
*bpp = bp;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue