0001
0002
0003
0004
0005
0006 #ifndef __XFS_AG_RESV_H__
0007 #define __XFS_AG_RESV_H__
0008
0009 int xfs_ag_resv_free(struct xfs_perag *pag);
0010 int xfs_ag_resv_init(struct xfs_perag *pag, struct xfs_trans *tp);
0011
0012 bool xfs_ag_resv_critical(struct xfs_perag *pag, enum xfs_ag_resv_type type);
0013 xfs_extlen_t xfs_ag_resv_needed(struct xfs_perag *pag,
0014 enum xfs_ag_resv_type type);
0015
0016 void xfs_ag_resv_alloc_extent(struct xfs_perag *pag, enum xfs_ag_resv_type type,
0017 struct xfs_alloc_arg *args);
0018 void xfs_ag_resv_free_extent(struct xfs_perag *pag, enum xfs_ag_resv_type type,
0019 struct xfs_trans *tp, xfs_extlen_t len);
0020
0021 static inline struct xfs_ag_resv *
0022 xfs_perag_resv(
0023 struct xfs_perag *pag,
0024 enum xfs_ag_resv_type type)
0025 {
0026 switch (type) {
0027 case XFS_AG_RESV_METADATA:
0028 return &pag->pag_meta_resv;
0029 case XFS_AG_RESV_RMAPBT:
0030 return &pag->pag_rmapbt_resv;
0031 default:
0032 return NULL;
0033 }
0034 }
0035
0036
0037
0038
0039
0040
0041 static inline void
0042 xfs_ag_resv_rmapbt_alloc(
0043 struct xfs_mount *mp,
0044 xfs_agnumber_t agno)
0045 {
0046 struct xfs_alloc_arg args = { NULL };
0047 struct xfs_perag *pag;
0048
0049 args.len = 1;
0050 pag = xfs_perag_get(mp, agno);
0051 xfs_ag_resv_alloc_extent(pag, XFS_AG_RESV_RMAPBT, &args);
0052 xfs_perag_put(pag);
0053 }
0054
0055 #endif