# SPDX-License-Identifier: GPL-2.0

config BTRFS_FS
	tristate "Btrfs filesystem support"
	select BLK_CGROUP_PUNT_BIO
	select CRC32
	select CRYPTO
	select CRYPTO_CRC32C
	select CRYPTO_XXHASH
	select CRYPTO_SHA256
	select CRYPTO_BLAKE2B
	select ZLIB_INFLATE
	select ZLIB_DEFLATE
	select LZO_COMPRESS
	select LZO_DECOMPRESS
	select ZSTD_COMPRESS
	select ZSTD_DECOMPRESS
	select FS_IOMAP
	select RAID6_PQ
	select XOR_BLOCKS
	depends on PAGE_SIZE_LESS_THAN_256KB

	help
	  Btrfs is a general purpose copy-on-write filesystem with extents,
	  writable snapshotting, support for multiple devices and many more
	  features focused on fault tolerance, repair and easy administration.

	  The filesystem disk format is no longer unstable, and it's not
	  expected to change unless there are strong reasons to do so. If there
	  is a format change, file systems with a unchanged format will
	  continue to be mountable and usable by newer kernels.

	  For more information, please see the web pages at
	  https://btrfs.readthedocs.io

	  To compile this file system support as a module, choose M here. The
	  module will be called btrfs.

	  If unsure, say N.

config BTRFS_FS_POSIX_ACL
	bool "Btrfs POSIX Access Control Lists"
	depends on BTRFS_FS
	select FS_POSIX_ACL
	help
	  POSIX Access Control Lists (ACLs) support permissions for users and
	  groups beyond the owner/group/world scheme.

	  If you don't know what Access Control Lists are, say N

config BTRFS_FS_RUN_SANITY_TESTS
	bool "Btrfs will run sanity tests upon loading"
	depends on BTRFS_FS
	help
	  This will run sanity tests for core functionality like free space,
	  extent maps, extent io, extent buffers, inodes, qgroups and others,
	  at module load time.  These are mostly regression tests and are only
	  interesting to developers.

	  If unsure, say N.

config BTRFS_DEBUG
	bool "Btrfs debugging support"
	depends on BTRFS_FS
	select REF_TRACKER if STACKTRACE_SUPPORT
	help
	  Enable run-time debugging support for the btrfs filesystem.

	  Additional potentially expensive checks, debugging functionality or
	  sysfs exported information is enabled, like leak checks of internal
	  objects, optional forced space fragmentation and /sys/fs/btrfs/debug .
	  This has negative impact on performance.

	  If unsure, say N.

config BTRFS_ASSERT
	bool "Btrfs assert support"
	depends on BTRFS_FS
	help
	  Enable run-time assertion checking. Additional safety checks are
	  done, simple enough not to affect performance but verify invariants
	  and assumptions of code to run properly. This may result in panics,
	  and is meant for developers but can be enabled in general.

	  If unsure, say N.

config BTRFS_ALLOCATOR_HINTS
	bool "Btrfs allocator hints"
	depends on BTRFS_FS
	default n
	help
	  Enable support for allocator hints. This feature allows to select
	  dedicated or preferred devices for meta data vs data, or prevent
	  allocation from a device at all. This feature does not interact
	  well with free space calculation because the formula expects to
	  allocate space always from a device with most free space which is
	  not true when hints are applied. It may also create issues if a
	  device from the pool dies resulting in a situation where there are
	  still enough RAID mirror members but the allocation hints don't
	  allow to allocate from specific devices.

	  You are advised to watch your free space closely with btrfs tools
	  instead of relying on df only.

	  Mounting a btrfs with this feature on or off is always possible,
	  there are no incompatible changes to the file system. But running
	  without this feature may place new chunks on unwanted devices and
	  you may want to clean up later by balancing the affected chunks.

	  Supported hint types in /sys/fs/btrfs/BTRFS-UUID/devinfo/ID/type:

	  - type = 0 - allocate data chunks from this ID first (recommended
	               for big disks with good sequential performance, e.g.
	               HDDs), prefers data on this device
	  - type = 1 - allocate meta data chunks from this ID first
	               (recommended for fast and small disks with good
	               latency, e.g. SSD/NVMe), prefers meta data on this
	               device
	  - type = 2 - allocate only meta data chunks from this ID, no data
	               chunks will ever be allocated from this device
	  - type = 3 - allocate only data chunks from this ID, no meta data
	               chunks will ever be allocated from this device
	  - type = 4 - allocate any chunks from this device last, will never
	               allocate any space from this device unless there isn't
	               enough space on other devices
	  - type = 5 - never allocate any new chunks, useful when putting a
	               device out of use and to avoid redundant chunk writes
	               during balance/replace

	  If unsure, say N.

config BTRFS_PER_DEVICE_IO_STATS
	bool "Btrfs per io devices stats"
	depends on BTRFS_FS
	default n
	help
	  Enable collecting io read stats per devices to evaluate the effects
	  of different read policies better.

	  This adds a new file /sys/fs/btrfs/BTRFS-UUID/devinfo/ID/read_stats.

	  If unsure, say N.

config BTRFS_READ_POLICIES
	bool "Btrfs read policies"
	depends on BTRFS_FS
	default n
	help
	  This enables btrfs read policies to control how btrfs selects stripes
	  from a mirror during read operations. This was originally part of
	  the experimental feature set but it is safe to use and can provide
	  huge performance benefits in certain scenarios without causing any
	  performance regressions.

	  This adds a new file /sys/fs/btrfs/BTRFS-UUID/read_policy.

	  If unsure, say N.

config BTRFS_EXPERIMENTAL
	bool "Btrfs experimental features"
	depends on BTRFS_FS
	default n
	help
	  Enable experimental features.  These features may not be stable enough
	  for end users.  This is meant for btrfs developers or users who wish
	  to test the functionality and report problems.

	  Current list:

	  - COW fixup worker warning - last warning before removing the
				       functionality catching out-of-band page
				       dirtying, not necessary since 5.8

	  - RAID mirror read policy - additional read policies for balancing
				      reading from redundant block group
				      profiles (currently: pid, round-robin,
				      fixed devid)

	  - send stream protocol v3 - fs-verity support

	  - checksum offload mode - sysfs knob to affect when checksums are
	                            calculated (at IO time, or in a thread)

	  - raid-stripe-tree - additional mapping of extents to devices to
			       support RAID1* profiles on zoned devices,
			       RAID56 not yet supported

	  - extent tree v2 - complex rework of extent tracking

	  - large folio support

	  If unsure, say N.
