uint, uint);
bool libxfs_trans_ordered_buf(xfs_trans_t *, struct xfs_buf *);
-struct xfs_buf *libxfs_trans_get_buf_map(struct xfs_trans *tp,
- struct xfs_buftarg *btp,
- struct xfs_buf_map *map, int nmaps,
- xfs_buf_flags_t flags);
+int libxfs_trans_get_buf_map(struct xfs_trans *tp, struct xfs_buftarg *btp,
+ struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags,
+ struct xfs_buf **bpp);
int libxfs_trans_read_buf_map(struct xfs_mount *mp, struct xfs_trans *tp,
struct xfs_buftarg *btp,
int numblks,
uint flags)
{
+ struct xfs_buf *bp;
+ int error;
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
- return libxfs_trans_get_buf_map(tp, btp, &map, 1, flags);
+
+ error = libxfs_trans_get_buf_map(tp, btp, &map, 1, flags, &bp);
+ if (error)
+ return NULL;
+ return bp;
}
static inline int
* If the transaction pointer is NULL, make this just a normal
* get_buf() call.
*/
-struct xfs_buf *
+int
libxfs_trans_get_buf_map(
struct xfs_trans *tp,
struct xfs_buftarg *target,
struct xfs_buf_map *map,
int nmaps,
- xfs_buf_flags_t flags)
+ xfs_buf_flags_t flags,
+ struct xfs_buf **bpp)
{
struct xfs_buf *bp;
struct xfs_buf_log_item *bip;
int error;
- if (!tp) {
- error = libxfs_buf_get_map(target, map, nmaps, 0, &bp);
- if (error)
- return NULL;
- return bp;
- }
+ *bpp = NULL;
+ if (!tp)
+ return libxfs_buf_get_map(target, map, nmaps, 0, bpp);
/*
* If we find the buffer in the cache with this transaction
ASSERT(bip != NULL);
bip->bli_recur++;
trace_xfs_trans_get_buf_recur(bip);
- return bp;
+ *bpp = bp;
+ return 0;
}
error = libxfs_buf_get_map(target, map, nmaps, 0, &bp);
if (error)
- return NULL;
+ return error;
ASSERT(!bp->b_error);
_libxfs_trans_bjoin(tp, bp, 1);
trace_xfs_trans_get_buf(bp->b_log_item);
- return bp;
+ *bpp = bp;
+ return 0;
}
xfs_buf_t *
if (error || nmap == 0)
goto out_free;
- bp = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0);
- error = bp ? bp->b_error : -EIO;
- if (error) {
- if (bp)
- xfs_trans_brelse(tp, bp);
+ error = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0, &bp);
+ if (error)
goto out_free;
- }
*bpp = bp;