Skip to content

Commit 49cdc4e

Browse files
Long LiChandan Babu R
authored andcommitted
xfs: get rid of xfs_ag_resv_rmapbt_alloc
The pag in xfs_ag_resv_rmapbt_alloc() is already held when the struct xfs_btree_cur is initialized in xfs_rmapbt_init_cursor(), so there is no need to get pag again. On the other hand, in xfs_rmapbt_free_block(), the similar function xfs_ag_resv_rmapbt_free() was removed in commit 92a0054 ("xfs: get rid of unnecessary xfs_perag_{get,put} pairs"), xfs_ag_resv_rmapbt_alloc() was left because scrub used it, but now scrub has removed it. Therefore, we could get rid of xfs_ag_resv_rmapbt_alloc() just like the rmap free block, make the code cleaner. Signed-off-by: Long Li <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent f3f7ae6 commit 49cdc4e

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

fs/xfs/libxfs/xfs_ag_resv.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,4 @@ xfs_perag_resv(
3333
}
3434
}
3535

36-
/*
37-
* RMAPBT reservation accounting wrappers. Since rmapbt blocks are sourced from
38-
* the AGFL, they are allocated one at a time and the reservation updates don't
39-
* require a transaction.
40-
*/
41-
static inline void
42-
xfs_ag_resv_rmapbt_alloc(
43-
struct xfs_mount *mp,
44-
xfs_agnumber_t agno)
45-
{
46-
struct xfs_alloc_arg args = { NULL };
47-
struct xfs_perag *pag;
48-
49-
args.len = 1;
50-
pag = xfs_perag_get(mp, agno);
51-
xfs_ag_resv_alloc_extent(pag, XFS_AG_RESV_RMAPBT, &args);
52-
xfs_perag_put(pag);
53-
}
54-
5536
#endif /* __XFS_AG_RESV_H__ */

fs/xfs/libxfs/xfs_rmap_btree.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ xfs_rmapbt_alloc_block(
8888
struct xfs_buf *agbp = cur->bc_ag.agbp;
8989
struct xfs_agf *agf = agbp->b_addr;
9090
struct xfs_perag *pag = cur->bc_ag.pag;
91+
struct xfs_alloc_arg args = { .len = 1 };
9192
int error;
9293
xfs_agblock_t bno;
9394

@@ -107,7 +108,11 @@ xfs_rmapbt_alloc_block(
107108
be32_add_cpu(&agf->agf_rmap_blocks, 1);
108109
xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_RMAP_BLOCKS);
109110

110-
xfs_ag_resv_rmapbt_alloc(cur->bc_mp, pag->pag_agno);
111+
/*
112+
* Since rmapbt blocks are sourced from the AGFL, they are allocated one
113+
* at a time and the reservation updates don't require a transaction.
114+
*/
115+
xfs_ag_resv_alloc_extent(pag, XFS_AG_RESV_RMAPBT, &args);
111116

112117
*stat = 1;
113118
return 0;

0 commit comments

Comments
 (0)