Skip to content

Commit 6a701eb

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: move and rename xfs_btree_read_bufl
Despite its name, xfs_btree_read_bufl doesn't contain any btree-related functionaliy and isn't used by the btree code. Move it to xfs_bmap.c, hard code the refval and ops arguments and rename it to xfs_bmap_read_buf. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
1 parent 6324b00 commit 6a701eb

3 files changed

Lines changed: 25 additions & 51 deletions

File tree

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,28 @@ xfs_bmap_forkoff_reset(
226226
}
227227
}
228228

229+
static int
230+
xfs_bmap_read_buf(
231+
struct xfs_mount *mp, /* file system mount point */
232+
struct xfs_trans *tp, /* transaction pointer */
233+
xfs_fsblock_t fsbno, /* file system block number */
234+
struct xfs_buf **bpp) /* buffer for fsbno */
235+
{
236+
struct xfs_buf *bp; /* return value */
237+
int error;
238+
239+
if (!xfs_verify_fsbno(mp, fsbno))
240+
return -EFSCORRUPTED;
241+
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
242+
XFS_FSB_TO_DADDR(mp, fsbno), mp->m_bsize, 0, &bp,
243+
&xfs_bmbt_buf_ops);
244+
if (!error) {
245+
xfs_buf_set_ref(bp, XFS_BMAP_BTREE_REF);
246+
*bpp = bp;
247+
}
248+
return error;
249+
}
250+
229251
#ifdef DEBUG
230252
STATIC struct xfs_buf *
231253
xfs_bmap_get_bp(
@@ -365,9 +387,7 @@ xfs_bmap_check_leaf_extents(
365387
bp = xfs_bmap_get_bp(cur, XFS_FSB_TO_DADDR(mp, bno));
366388
if (!bp) {
367389
bp_release = 1;
368-
error = xfs_btree_read_bufl(mp, NULL, bno, &bp,
369-
XFS_BMAP_BTREE_REF,
370-
&xfs_bmbt_buf_ops);
390+
error = xfs_bmap_read_buf(mp, NULL, bno, &bp);
371391
if (xfs_metadata_is_sick(error))
372392
xfs_btree_mark_sick(cur);
373393
if (error)
@@ -454,9 +474,7 @@ xfs_bmap_check_leaf_extents(
454474
bp = xfs_bmap_get_bp(cur, XFS_FSB_TO_DADDR(mp, bno));
455475
if (!bp) {
456476
bp_release = 1;
457-
error = xfs_btree_read_bufl(mp, NULL, bno, &bp,
458-
XFS_BMAP_BTREE_REF,
459-
&xfs_bmbt_buf_ops);
477+
error = xfs_bmap_read_buf(mp, NULL, bno, &bp);
460478
if (xfs_metadata_is_sick(error))
461479
xfs_btree_mark_sick(cur);
462480
if (error)
@@ -573,8 +591,7 @@ xfs_bmap_btree_to_extents(
573591
return -EFSCORRUPTED;
574592
}
575593
#endif
576-
error = xfs_btree_read_bufl(mp, tp, cbno, &cbp, XFS_BMAP_BTREE_REF,
577-
&xfs_bmbt_buf_ops);
594+
error = xfs_bmap_read_buf(mp, tp, cbno, &cbp);
578595
if (xfs_metadata_is_sick(error))
579596
xfs_btree_mark_sick(cur);
580597
if (error)

fs/xfs/libxfs/xfs_btree.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -859,36 +859,6 @@ xfs_btree_offsets(
859859
}
860860
}
861861

862-
/*
863-
* Get a buffer for the block, return it read in.
864-
* Long-form addressing.
865-
*/
866-
int
867-
xfs_btree_read_bufl(
868-
struct xfs_mount *mp, /* file system mount point */
869-
struct xfs_trans *tp, /* transaction pointer */
870-
xfs_fsblock_t fsbno, /* file system block number */
871-
struct xfs_buf **bpp, /* buffer for fsbno */
872-
int refval, /* ref count value for buffer */
873-
const struct xfs_buf_ops *ops)
874-
{
875-
struct xfs_buf *bp; /* return value */
876-
xfs_daddr_t d; /* real disk block address */
877-
int error;
878-
879-
if (!xfs_verify_fsbno(mp, fsbno))
880-
return -EFSCORRUPTED;
881-
d = XFS_FSB_TO_DADDR(mp, fsbno);
882-
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
883-
mp->m_bsize, 0, &bp, ops);
884-
if (error)
885-
return error;
886-
if (bp)
887-
xfs_buf_set_ref(bp, refval);
888-
*bpp = bp;
889-
return 0;
890-
}
891-
892862
STATIC int
893863
xfs_btree_readahead_fsblock(
894864
struct xfs_btree_cur *cur,

fs/xfs/libxfs/xfs_btree.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -378,19 +378,6 @@ xfs_btree_offsets(
378378
int *first, /* output: first byte offset */
379379
int *last); /* output: last byte offset */
380380

381-
/*
382-
* Get a buffer for the block, return it read in.
383-
* Long-form addressing.
384-
*/
385-
int /* error */
386-
xfs_btree_read_bufl(
387-
struct xfs_mount *mp, /* file system mount point */
388-
struct xfs_trans *tp, /* transaction pointer */
389-
xfs_fsblock_t fsbno, /* file system block number */
390-
struct xfs_buf **bpp, /* buffer for fsbno */
391-
int refval, /* ref count value for buffer */
392-
const struct xfs_buf_ops *ops);
393-
394381
/*
395382
* Initialise a new btree block header
396383
*/

0 commit comments

Comments
 (0)