Skip to content

Commit a095686

Browse files
author
Darrick J. Wong
committed
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. There are also a few things we need to do to finalize a btree update; that's covered in the next patch. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 8c1771c commit a095686

14 files changed

Lines changed: 675 additions & 42 deletions

File tree

Documentation/filesystems/xfs/xfs-online-fsck-design.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,13 +2270,12 @@ follows:
22702270
pointing to the xfile.
22712271

22722272
3. Pass the buffer cache target, buffer ops, and other information to
2273-
``xfbtree_create`` to write an initial tree header and root block to the
2274-
xfile.
2273+
``xfbtree_init`` to initialize the passed in ``struct xfbtree`` and write an
2274+
initial root block to the xfile.
22752275
Each btree type should define a wrapper that passes necessary arguments to
22762276
the creation function.
22772277
For example, rmap btrees define ``xfs_rmapbt_mem_create`` to take care of
22782278
all the necessary details for callers.
2279-
A ``struct xfbtree`` object will be returned.
22802279

22812280
4. Pass the xfbtree object to the btree cursor creation function for the
22822281
btree type.

fs/xfs/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ config XFS_LIVE_HOOKS
131131
config XFS_MEMORY_BUFS
132132
bool
133133

134+
config XFS_BTREE_IN_MEM
135+
bool
136+
134137
config XFS_ONLINE_SCRUB
135138
bool "XFS online metadata check support"
136139
default n
@@ -173,6 +176,7 @@ config XFS_ONLINE_REPAIR
173176
bool "XFS online metadata repair support"
174177
default n
175178
depends on XFS_FS && XFS_ONLINE_SCRUB
179+
select XFS_BTREE_IN_MEM
176180
help
177181
If you say Y here you will be able to repair metadata on a
178182
mounted XFS filesystem. This feature is intended to reduce

fs/xfs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ endif
138138
xfs-$(CONFIG_XFS_DRAIN_INTENTS) += xfs_drain.o
139139
xfs-$(CONFIG_XFS_LIVE_HOOKS) += xfs_hooks.o
140140
xfs-$(CONFIG_XFS_MEMORY_BUFS) += xfs_buf_mem.o
141+
xfs-$(CONFIG_XFS_BTREE_IN_MEM) += libxfs/xfs_btree_mem.o
141142

142143
# online scrub/repair
143144
ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y)

0 commit comments

Comments
 (0)