49cdc4e834
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 92a005448f
("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 <leo.lilong@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
37 lines
1021 B
C
37 lines
1021 B
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Copyright (C) 2016 Oracle. All Rights Reserved.
|
|
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
|
*/
|
|
#ifndef __XFS_AG_RESV_H__
|
|
#define __XFS_AG_RESV_H__
|
|
|
|
void xfs_ag_resv_free(struct xfs_perag *pag);
|
|
int xfs_ag_resv_init(struct xfs_perag *pag, struct xfs_trans *tp);
|
|
|
|
bool xfs_ag_resv_critical(struct xfs_perag *pag, enum xfs_ag_resv_type type);
|
|
xfs_extlen_t xfs_ag_resv_needed(struct xfs_perag *pag,
|
|
enum xfs_ag_resv_type type);
|
|
|
|
void xfs_ag_resv_alloc_extent(struct xfs_perag *pag, enum xfs_ag_resv_type type,
|
|
struct xfs_alloc_arg *args);
|
|
void xfs_ag_resv_free_extent(struct xfs_perag *pag, enum xfs_ag_resv_type type,
|
|
struct xfs_trans *tp, xfs_extlen_t len);
|
|
|
|
static inline struct xfs_ag_resv *
|
|
xfs_perag_resv(
|
|
struct xfs_perag *pag,
|
|
enum xfs_ag_resv_type type)
|
|
{
|
|
switch (type) {
|
|
case XFS_AG_RESV_METADATA:
|
|
return &pag->pag_meta_resv;
|
|
case XFS_AG_RESV_RMAPBT:
|
|
return &pag->pag_rmapbt_resv;
|
|
default:
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
#endif /* __XFS_AG_RESV_H__ */
|