diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:31 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:34 -0800 |
commit | ec100ee02c1cbe0b667d9a079367d8753146345f (patch) | |
tree | fd07b54ce11aee4bae20407e0833fdc3ee789edb /fs/xfs/scrub/xfbtree.h | |
parent | dfd8359f03395dd600d7b5abf53a6da7d079c0a1 (diff) |
xfs: support in-memory btrees
Adapt the generic btree cursor code to be able to create a btree whose
buffers come from a (presumably in-memory) buftarg with a header block
that's specific to in-memory btrees. We'll connect this to other parts
of online scrub in the next patches.
Note that in-memory btrees always have a block size matching the system
memory page size for efficiency reasons.
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 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/xfs/scrub/xfbtree.h b/fs/xfs/scrub/xfbtree.h new file mode 100644 index 000000000000..b3836f21085d --- /dev/null +++ b/fs/xfs/scrub/xfbtree.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2022 Oracle. All Rights Reserved. + * Author: Darrick J. Wong <djwong@kernel.org> + */ +#ifndef XFS_SCRUB_XFBTREE_H__ +#define XFS_SCRUB_XFBTREE_H__ + +#ifdef CONFIG_XFS_IN_MEMORY_BTREE + +/* Root block for an in-memory btree. */ +struct xfs_btree_mem_head { + __be32 mh_magic; + __be32 mh_nlevels; + __be64 mh_owner; + __be64 mh_root; + uuid_t mh_uuid; +}; + +#define XFS_BTREE_MEM_HEAD_MAGIC 0x4341544D /* "CATM" */ + +/* xfile-backed in-memory btrees */ + +struct xfbtree { + /* buffer cache target for this in-memory btree */ + struct xfs_buftarg *target; + + /* Owner of this btree. */ + unsigned long long owner; +}; + +#endif /* CONFIG_XFS_IN_MEMORY_BTREE */ + +#endif /* XFS_SCRUB_XFBTREE_H__ */ |