Hook beamfs into fs/Kconfig, among the miscellaneous filesystems, and into fs/Makefile. Besides BEAMFS_FS there are two debugging options: BEAMFS_DEBUG_TREE enables the tree checker, and BEAMFS_ORDERED_META writes metadata blocks synchronously in dependency order, an experiment kept to measure ordering questions. Both default to off. The Makefile adds the warnings the module is developed with; whether they stop the build is left to CONFIG_WERROR. Assisted-by: LLM Signed-off-by: Aurelien DESBRIERES --- fs/Kconfig | 1 + fs/Makefile | 1 + fs/beamfs/Kconfig | 64 ++++++++++++++++++++++++++++++++++++++++++++++ fs/beamfs/Makefile | 21 +++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 fs/beamfs/Kconfig create mode 100644 fs/beamfs/Makefile diff --git a/fs/Kconfig b/fs/Kconfig index 46313f65ee54..7c864b9549d4 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -313,6 +313,7 @@ source "fs/affs/Kconfig" source "fs/ecryptfs/Kconfig" source "fs/hfs/Kconfig" source "fs/hfsplus/Kconfig" +source "fs/beamfs/Kconfig" source "fs/befs/Kconfig" source "fs/jffs2/Kconfig" # UBIFS File system configuration diff --git a/fs/Makefile b/fs/Makefile index 16f1108b64e1..632c15c85254 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -110,6 +110,7 @@ obj-$(CONFIG_XFS_FS) += xfs/ obj-$(CONFIG_9P_FS) += 9p/ obj-$(CONFIG_AFS_FS) += afs/ obj-$(CONFIG_NILFS2_FS) += nilfs2/ +obj-$(CONFIG_BEAMFS_FS) += beamfs/ obj-$(CONFIG_BEFS_FS) += befs/ obj-y += hostfs/ obj-$(CONFIG_CACHEFILES) += cachefiles/ diff --git a/fs/beamfs/Kconfig b/fs/beamfs/Kconfig new file mode 100644 index 000000000000..56be9beeb588 --- /dev/null +++ b/fs/beamfs/Kconfig @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# beamfs filesystem configuration +# + +config BEAMFS_FS + tristate "beamfs filesystem support" + depends on BLOCK + select BUFFER_HEAD + select FS_IOMAP + select CRC32 + select REED_SOLOMON + select REED_SOLOMON_ENC8 + select REED_SOLOMON_DEC8 + help + beamfs is a block-device filesystem that corrects corrupted bytes + in place, on a single device, without a second copy to repair + from. Data and directory blocks carry Reed-Solomon RS(255,239) + parity over GF(2^8) inside the block, indirect blocks carry it in + a region of their own, and every read decodes. + + Up to eight corrupted bytes per 255-byte codeword are corrected. + A codeword the decoder reports as uncorrectable fails the read + with -EIO. Nothing is guaranteed beyond eight bytes per codeword. + + It is meant for storage that takes bit flips the device does not + correct itself, such as single-event upsets. See + Documentation/filesystems/beamfs.rst. + + To compile this file system support as a module, choose M here: + the module will be called beamfs. + + If unsure, say N. + +config BEAMFS_DEBUG_TREE + bool "beamfs: check the indirect tree invariant at every store" + depends on BEAMFS_FS + help + Record every pointer installed in an indirect block and check + each later store to the same slot against that record. A slot + that held a live pointer and reads back as zero is reported + with a stack trace at the instant it happens, instead of being + counted by fsck long after. + + Costs one hash lookup and sixteen bytes per live pointer. Say + N for production. + +config BEAMFS_ORDERED_META + bool "Write metadata in dependency order (slow, experimental)" + depends on BEAMFS_FS + default n + help + Write every metadata block to the medium before anything names + it: one synchronous write per level of indirection, up to four + for a block reached through the triple indirect. + + This exists to answer a question, not to be enabled. beamfs + relies on mark_buffer_dirty for ordering and mark_buffer_dirty + gives none, and this forces the safe order at whatever cost in + speed so that the hypothesis can be measured rather than + argued. A journal is how the same property is had for one + sequential write instead. + + Say N. diff --git a/fs/beamfs/Makefile b/fs/beamfs/Makefile new file mode 100644 index 000000000000..d01ad86a0c14 --- /dev/null +++ b/fs/beamfs/Makefile @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for the beamfs filesystem. +# + +obj-$(CONFIG_BEAMFS_FS) += beamfs.o + +beamfs-y := treecheck.o super.o inode.o dir.o dirent.o file.o \ + file_inline.o scrub.o indparity.o rsbench.o budget.o clock.o \ + alert.o edac.o alloc.o namei.o + +# define_trace.h includes beamfs_trace.h by name, from super.c. +CFLAGS_super.o += -I$(src) + +# The warnings the module is developed with. Whether they stop the +# build is left to CONFIG_WERROR. +ccflags-y += -Wall -Wextra -Wformat=2 -Werror=format +ccflags-y += -Wmissing-prototypes -Wmissing-declarations +ccflags-y += -Wundef -Wstrict-prototypes +# The VFS passes handlers more arguments than most of them use. +ccflags-y += -Wno-unused-parameter -- 2.55.0