summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ag_resv.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2021-06-02 10:48:24 +1000
committerDave Chinner <david@fromorbit.com>2021-06-02 10:48:24 +1000
commit07b6403a6873045344b0c18cbb4a4360854f6d76 (patch)
treee52bfa528f7706660d5f70edf65525dc6037c2c1 /fs/xfs/libxfs/xfs_ag_resv.h
parent61aa005a5bd7705e0bdca8b40c694369d40fb93f (diff)
xfs: move perag structure and setup to libxfs/xfs_ag.[ch]
Move the xfs_perag infrastructure to the libxfs files that contain all the per AG infrastructure. This helps set up for passing perags around all the code instead of bare agnos with minimal extra includes for existing files. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_ag_resv.h')
-rw-r--r--fs/xfs/libxfs/xfs_ag_resv.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_ag_resv.h b/fs/xfs/libxfs/xfs_ag_resv.h
index 8a8eb4bc48bb..b74b210008ea 100644
--- a/fs/xfs/libxfs/xfs_ag_resv.h
+++ b/fs/xfs/libxfs/xfs_ag_resv.h
@@ -18,6 +18,21 @@ void xfs_ag_resv_alloc_extent(struct xfs_perag *pag, enum xfs_ag_resv_type type,
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;
+ }
+}
+
/*
* RMAPBT reservation accounting wrappers. Since rmapbt blocks are sourced from
* the AGFL, they are allocated one at a time and the reservation updates don't