Skip to content

Commit 6324b00

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: remove xfs_btree_reada_bufs
xfs_btree_reada_bufl just wraps xfs_btree_readahead and a agblock to daddr conversion. Just open code it's three callsites in the two callers (One of which isn't even btree related). 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 5eec8fa commit 6324b00

3 files changed

Lines changed: 14 additions & 42 deletions

File tree

fs/xfs/libxfs/xfs_btree.c

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -889,27 +889,6 @@ xfs_btree_read_bufl(
889889
return 0;
890890
}
891891

892-
/*
893-
* Read-ahead the block, don't wait for it, don't return a buffer.
894-
* Short-form addressing.
895-
*/
896-
/* ARGSUSED */
897-
void
898-
xfs_btree_reada_bufs(
899-
struct xfs_mount *mp, /* file system mount point */
900-
xfs_agnumber_t agno, /* allocation group number */
901-
xfs_agblock_t agbno, /* allocation group block number */
902-
xfs_extlen_t count, /* count of filesystem blocks */
903-
const struct xfs_buf_ops *ops)
904-
{
905-
xfs_daddr_t d;
906-
907-
ASSERT(agno != NULLAGNUMBER);
908-
ASSERT(agbno != NULLAGBLOCK);
909-
d = XFS_AGB_TO_DADDR(mp, agno, agbno);
910-
xfs_buf_readahead(mp->m_ddev_targp, d, mp->m_bsize * count, ops);
911-
}
912-
913892
STATIC int
914893
xfs_btree_readahead_fsblock(
915894
struct xfs_btree_cur *cur,
@@ -940,22 +919,25 @@ STATIC int
940919
xfs_btree_readahead_agblock(
941920
struct xfs_btree_cur *cur,
942921
int lr,
943-
struct xfs_btree_block *block)
922+
struct xfs_btree_block *block)
944923
{
945-
int rval = 0;
924+
struct xfs_mount *mp = cur->bc_mp;
925+
xfs_agnumber_t agno = cur->bc_ag.pag->pag_agno;
946926
xfs_agblock_t left = be32_to_cpu(block->bb_u.s.bb_leftsib);
947927
xfs_agblock_t right = be32_to_cpu(block->bb_u.s.bb_rightsib);
948-
928+
int rval = 0;
949929

950930
if ((lr & XFS_BTCUR_LEFTRA) && left != NULLAGBLOCK) {
951-
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_ag.pag->pag_agno,
952-
left, 1, cur->bc_ops->buf_ops);
931+
xfs_buf_readahead(mp->m_ddev_targp,
932+
XFS_AGB_TO_DADDR(mp, agno, left),
933+
mp->m_bsize, cur->bc_ops->buf_ops);
953934
rval++;
954935
}
955936

956937
if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLAGBLOCK) {
957-
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_ag.pag->pag_agno,
958-
right, 1, cur->bc_ops->buf_ops);
938+
xfs_buf_readahead(mp->m_ddev_targp,
939+
XFS_AGB_TO_DADDR(mp, agno, right),
940+
mp->m_bsize, cur->bc_ops->buf_ops);
959941
rval++;
960942
}
961943

fs/xfs/libxfs/xfs_btree.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -391,18 +391,6 @@ xfs_btree_read_bufl(
391391
int refval, /* ref count value for buffer */
392392
const struct xfs_buf_ops *ops);
393393

394-
/*
395-
* Read-ahead the block, don't wait for it, don't return a buffer.
396-
* Short-form addressing.
397-
*/
398-
void /* error */
399-
xfs_btree_reada_bufs(
400-
struct xfs_mount *mp, /* file system mount point */
401-
xfs_agnumber_t agno, /* allocation group number */
402-
xfs_agblock_t agbno, /* allocation group block number */
403-
xfs_extlen_t count, /* count of filesystem blocks */
404-
const struct xfs_buf_ops *ops);
405-
406394
/*
407395
* Initialise a new btree block header
408396
*/

fs/xfs/xfs_iwalk.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ xfs_iwalk_ichunk_ra(
100100
struct xfs_inobt_rec_incore *irec)
101101
{
102102
struct xfs_ino_geometry *igeo = M_IGEO(mp);
103+
xfs_agnumber_t agno = pag->pag_agno;
103104
xfs_agblock_t agbno;
104105
struct blk_plug plug;
105106
int i; /* inode chunk index */
@@ -112,8 +113,9 @@ xfs_iwalk_ichunk_ra(
112113

113114
imask = xfs_inobt_maskn(i, igeo->inodes_per_cluster);
114115
if (imask & ~irec->ir_free) {
115-
xfs_btree_reada_bufs(mp, pag->pag_agno, agbno,
116-
igeo->blocks_per_cluster,
116+
xfs_buf_readahead(mp->m_ddev_targp,
117+
XFS_AGB_TO_DADDR(mp, agno, agbno),
118+
igeo->blocks_per_cluster * mp->m_bsize,
117119
&xfs_inode_buf_ops);
118120
}
119121
agbno += igeo->blocks_per_cluster;

0 commit comments

Comments
 (0)