diff options
| author | Kent Overstreet <kent.overstreet@gmail.com> | 2017-03-16 22:18:50 -0800 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:07 -0400 |
| commit | 1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a (patch) | |
| tree | 9192de91a00908ee898bc331ac8b0544d6fc030a | |
| parent | 0d29a833b7b1800bd2759bbc064b5ada4729caf5 (diff) | |
| download | linux-1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a.tar.gz linux-1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a.tar.bz2 linux-1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a.zip | |
bcachefs: Initial commit
Initially forked from drivers/md/bcache, bcachefs is a new copy-on-write
filesystem with every feature you could possibly want.
Website: https://bcachefs.org
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
122 files changed, 57147 insertions, 0 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index aa7e03cc1941..0d6cb927872a 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -48,6 +48,7 @@ source "fs/ocfs2/Kconfig" source "fs/btrfs/Kconfig" source "fs/nilfs2/Kconfig" source "fs/f2fs/Kconfig" +source "fs/bcachefs/Kconfig" source "fs/zonefs/Kconfig" endif # BLOCK diff --git a/fs/Makefile b/fs/Makefile index f9541f40be4e..75522f88e763 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -123,6 +123,7 @@ obj-$(CONFIG_OCFS2_FS) += ocfs2/ obj-$(CONFIG_BTRFS_FS) += btrfs/ obj-$(CONFIG_GFS2_FS) += gfs2/ obj-$(CONFIG_F2FS_FS) += f2fs/ +obj-$(CONFIG_BCACHEFS_FS) += bcachefs/ obj-$(CONFIG_CEPH_FS) += ceph/ obj-$(CONFIG_PSTORE) += pstore/ obj-$(CONFIG_EFIVAR_FS) += efivarfs/ diff --git a/fs/bcachefs/Kconfig b/fs/bcachefs/Kconfig new file mode 100644 index 000000000000..c13f2cfa6489 --- /dev/null +++ b/fs/bcachefs/Kconfig @@ -0,0 +1,52 @@ + +config BCACHEFS_FS + tristate "bcachefs filesystem support" + depends on BLOCK + select EXPORTFS + select CLOSURES + select LIBCRC32C + select FS_POSIX_ACL + select LZ4_COMPRESS + select LZ4_DECOMPRESS + select ZLIB_DEFLATE + select ZLIB_INFLATE + select ZSTD_COMPRESS + select ZSTD_DECOMPRESS + select CRYPTO_SHA256 + select CRYPTO_CHACHA20 + select CRYPTO_POLY1305 + select KEYS + help + The bcachefs filesystem - a modern, copy on write filesystem, with + support for multiple devices, compression, checksumming, etc. + +config BCACHEFS_QUOTA + bool "bcachefs quota support" + depends on BCACHEFS_FS + select QUOTACTL + +config BCACHEFS_POSIX_ACL + bool "bcachefs POSIX ACL support" + depends on BCACHEFS_FS + select FS_POSIX_ACL + +config BCACHEFS_DEBUG + bool "bcachefs debugging" + depends on BCACHEFS_FS + help + Enables many extra debugging checks and assertions. + + The resulting code will be significantly slower than normal; you + probably shouldn't select this option unless you're a developer. + +config BCACHEFS_TESTS + bool "bcachefs unit and performance tests" + depends on BCACHEFS_FS + help + Include some unit and performance tests for the core btree code + +config BCACHEFS_NO_LATENCY_ACCT + bool "disable latency accounting and time stats" + depends on BCACHEFS_FS + help + This disables device latency tracking and time stats, only for performance testing diff --git a/fs/bcachefs/Makefile b/fs/bcachefs/Makefile new file mode 100644 index 000000000000..13cd6d2cdc91 --- /dev/null +++ b/fs/bcachefs/Makefile @@ -0,0 +1,53 @@ + +obj-$(CONFIG_BCACHEFS_FS) += bcachefs.o + +bcachefs-y := \ + acl.o \ + alloc.o \ + bkey.o \ + bkey_methods.o \ + bset.o \ + btree_cache.o \ + btree_gc.o \ + btree_io.o \ + btree_iter.o \ + btree_update_interior.o \ + btree_update_leaf.o \ + buckets.o \ + chardev.o \ + checksum.o \ + clock.o \ + compress.o \ + debug.o \ + dirent.o \ + disk_groups.o \ + error.o \ + extents.o \ + fs.o \ + fs-ioctl.o \ + fs-io.o \ + fsck.o \ + inode.o \ + io.o \ + journal.o \ + journal_io.o \ + journal_reclaim.o \ + journal_seq_blacklist.o \ + keylist.o \ + migrate.o \ + move.o \ + movinggc.o \ + opts.o \ + quota.o \ + rebalance.o \ + recovery.o \ + replicas.o \ + siphash.o \ + six.o \ + super.o \ + super-io.o \ + sysfs.o \ + tests.o \ + trace.o \ + util.o \ + xattr.o diff --git a/fs/bcachefs/acl.c b/fs/bcachefs/acl.c new file mode 100644 index 000000000000..eaf5c8e138fb --- /dev/null +++ b/fs/bcachefs/acl.c @@ -0,0 +1,387 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifdef CONFIG_BCACHEFS_POSIX_ACL + +#include "bcachefs.h" + +#include <linux/fs.h> +#include <linux/posix_acl.h> +#include <linux/posix_acl_xattr.h> +#include <linux/sched.h> +#include <linux/slab.h> + +#include "acl.h" +#include "fs.h" +#include "xattr.h" + +static inline size_t bch2_acl_size(unsigned nr_short, unsigned nr_long) +{ + return sizeof(bch_acl_header) + + sizeof(bch_acl_entry_short) * nr_short + + sizeof(bch_acl_entry) * nr_long; +} + +static inline int acl_to_xattr_type(int type) +{ + switch (type) { + case ACL_TYPE_ACCESS: + return BCH_XATTR_INDEX_POSIX_ACL_ACCESS; + case ACL_TYPE_DEFAULT: + return BCH_XATTR_INDEX_POSIX_ACL_DEFAULT; + default: + BUG(); + } +} |
