summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-20 16:13:09 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:41:16 -0700
commitf47d10306ea759e3e0749de65cdd1680383be13f (patch)
tree76aa435bafd1e6552aaef64792406740e854d62d /fs/xfs/libxfs
parent4f7bd0146279206b1738b93994e0421ed70ed9a7 (diff)
xfs: connect in-memory btrees to xfiles
Add to our stubbed-out in-memory btrees the ability to connect them with an actual in-memory backing file (aka xfiles) and the necessary pieces to track free space in the xfile and flush dirty xfbtree buffers on demand, which we'll need for online repair. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_btree_mem.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_btree_mem.h b/fs/xfs/libxfs/xfs_btree_mem.h
index 76304233d86d..ddeb05ddba4a 100644
--- a/fs/xfs/libxfs/xfs_btree_mem.h
+++ b/fs/xfs/libxfs/xfs_btree_mem.h
@@ -18,6 +18,14 @@ void xfs_btree_mem_init_ptr_from_cur(struct xfs_btree_cur *cur,
union xfs_btree_ptr *ptr);
struct xfs_btree_cur *xfs_btree_mem_dup_cursor(struct xfs_btree_cur *cur);
unsigned int xfs_btree_mem_head_nlevels(struct xfs_buf *head_bp);
+
+struct xfbtree *xfbtree_create(struct xfs_mount *mp, xfs_btnum_t btnum,
+ const struct xfs_buf_ops *b_ops, unsigned int flags,
+ const char *description);
+int xfbtree_alloc_block(struct xfs_btree_cur *cur,
+ const union xfs_btree_ptr *start, union xfs_btree_ptr *ptr,
+ int *stat);
+int xfbtree_free_block(struct xfs_btree_cur *cur, struct xfs_buf *bp);
#else
static inline struct xfs_buftarg *
xfbtree_target(struct xfbtree *xfbtree)
@@ -54,6 +62,31 @@ xfs_btree_mem_head_nlevels(struct xfs_buf *head_bp)
{
return 0;
}
+
+static inline struct xfbtree *
+xfbtree_create(struct xfs_mount *mp, xfs_btnum_t btnum,
+ const struct xfs_buf_ops *b_ops, unsigned int flags,
+ const char *description)
+{
+ return NULL;
+}
+
+static inline int
+xfbtree_alloc_block(struct xfs_btree_cur *cur,
+ const union xfs_btree_ptr *start, union xfs_btree_ptr *ptr,
+ int *stat)
+{
+ return -EINVAL;
+}
+
+static inline int
+xfbtree_free_block(struct xfs_btree_cur *cur, struct xfs_buf *bp)
+{
+ return -EINVAL;
+}
#endif /* CONFIG_XFS_ONLINE_REPAIR */
+/* btree has long pointers */
+#define XFBTREE_CREATE_LONG_PTRS (1U << 0)
+
#endif /* __XFS_BTREE_MEM_H__ */