diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:32 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:35 -0800 |
commit | 37c015cada4df6aeb7efae7c95304e718eea5535 (patch) | |
tree | d02856d76525040a888fd06ba27fb578f4767a3d /fs/xfs/scrub/xfbtree.h | |
parent | ec100ee02c1cbe0b667d9a079367d8753146345f (diff) |
xfs: connect in-memory btrees to xfilesin-memory-btrees_2022-11-09
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/scrub/xfbtree.h')
-rw-r--r-- | fs/xfs/scrub/xfbtree.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/fs/xfs/scrub/xfbtree.h b/fs/xfs/scrub/xfbtree.h index b3836f21085d..bdbf850bf7a1 100644 --- a/fs/xfs/scrub/xfbtree.h +++ b/fs/xfs/scrub/xfbtree.h @@ -22,13 +22,36 @@ struct xfs_btree_mem_head { /* xfile-backed in-memory btrees */ struct xfbtree { - /* buffer cache target for this in-memory btree */ + /* buffer cache target for the xfile backing this in-memory btree */ struct xfs_buftarg *target; + /* Bitmap of free space from pos to used */ + struct xbitmap *freespace; + + /* Number of xfile blocks actually used by this xfbtree. */ + xfileoff_t xf_used; + /* Owner of this btree. */ unsigned long long owner; + + /* Minimum and maximum records per block. */ + unsigned int maxrecs[2]; + unsigned int minrecs[2]; }; +/* The head of the in-memory btree is always at block 0 */ +#define XFBTREE_HEAD_BLOCK 0 + +/* in-memory btrees are always created with an empty leaf block at block 1 */ +#define XFBTREE_INIT_LEAF_BLOCK 1 + +int xfbtree_head_read_buf(struct xfbtree *xfbt, struct xfs_trans *tp, + struct xfs_buf **bpp); + +void xfbtree_destroy(struct xfbtree *xfbt); +int xfbtree_trans_commit(struct xfbtree *xfbt, struct xfs_trans *tp); +void xfbtree_trans_cancel(struct xfbtree *xfbt, struct xfs_trans *tp); + #endif /* CONFIG_XFS_IN_MEMORY_BTREE */ #endif /* XFS_SCRUB_XFBTREE_H__ */ |