Skip to content

Commit 841263e

Browse files
committed
xfs: make xfs_buf_get return an error code
Convert xfs_buf_get() to return numeric error codes like most everywhere else in xfs. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent 4ed8e27 commit 841263e

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

fs/xfs/libxfs/xfs_attr_remote.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,9 @@ xfs_attr_rmtval_set(
545545
dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
546546
dblkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
547547

548-
bp = xfs_buf_get(mp->m_ddev_targp, dblkno, dblkcnt);
549-
if (!bp)
550-
return -ENOMEM;
548+
error = xfs_buf_get(mp->m_ddev_targp, dblkno, dblkcnt, &bp);
549+
if (error)
550+
return error;
551551
bp->b_ops = &xfs_attr3_rmt_buf_ops;
552552

553553
xfs_attr_rmtval_copyin(mp, bp, args->dp->i_ino, &offset,

fs/xfs/libxfs/xfs_sb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -985,22 +985,22 @@ xfs_update_secondary_sbs(
985985
for (agno = 1; agno < mp->m_sb.sb_agcount; agno++) {
986986
struct xfs_buf *bp;
987987

988-
bp = xfs_buf_get(mp->m_ddev_targp,
988+
error = xfs_buf_get(mp->m_ddev_targp,
989989
XFS_AG_DADDR(mp, agno, XFS_SB_DADDR),
990-
XFS_FSS_TO_BB(mp, 1));
990+
XFS_FSS_TO_BB(mp, 1), &bp);
991991
/*
992992
* If we get an error reading or writing alternate superblocks,
993993
* continue. xfs_repair chooses the "best" superblock based
994994
* on most matches; if we break early, we'll leave more
995995
* superblocks un-updated than updated, and xfs_repair may
996996
* pick them over the properly-updated primary.
997997
*/
998-
if (!bp) {
998+
if (error) {
999999
xfs_warn(mp,
10001000
"error allocating secondary superblock for ag %d",
10011001
agno);
10021002
if (!saved_error)
1003-
saved_error = -ENOMEM;
1003+
saved_error = error;
10041004
continue;
10051005
}
10061006

fs/xfs/xfs_buf.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,20 +201,16 @@ void xfs_buf_readahead_map(struct xfs_buftarg *target,
201201
struct xfs_buf_map *map, int nmaps,
202202
const struct xfs_buf_ops *ops);
203203

204-
static inline struct xfs_buf *
204+
static inline int
205205
xfs_buf_get(
206206
struct xfs_buftarg *target,
207207
xfs_daddr_t blkno,
208-
size_t numblks)
208+
size_t numblks,
209+
struct xfs_buf **bpp)
209210
{
210-
struct xfs_buf *bp;
211-
int error;
212211
DEFINE_SINGLE_BUF_MAP(map, blkno, numblks);
213212

214-
error = xfs_buf_get_map(target, &map, 1, 0, &bp);
215-
if (error)
216-
return NULL;
217-
return bp;
213+
return xfs_buf_get_map(target, &map, 1, 0, bpp);
218214
}
219215

220216
static inline struct xfs_buf *

0 commit comments

Comments
 (0)