From 1c6fdbd8f2465ddfb73a01ec620cbf3d14044e1a Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 16 Mar 2017 22:18:50 -0800 Subject: 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 --- fs/bcachefs/super_types.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 fs/bcachefs/super_types.h (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h new file mode 100644 index 000000000000..4d8265bb3154 --- /dev/null +++ b/fs/bcachefs/super_types.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _BCACHEFS_SUPER_TYPES_H +#define _BCACHEFS_SUPER_TYPES_H + +struct bch_sb_handle { + struct bch_sb *sb; + struct block_device *bdev; + struct bio *bio; + void *holder; + unsigned page_order; + fmode_t mode; + unsigned have_layout:1; + unsigned have_bio:1; + unsigned fs_sb:1; +}; + +struct bch_devs_mask { + unsigned long d[BITS_TO_LONGS(BCH_SB_MEMBERS_MAX)]; +}; + +struct bch_devs_list { + u8 nr; + u8 devs[BCH_REPLICAS_MAX + 1]; +}; + +struct bch_member_cpu { + u64 nbuckets; /* device size */ + u16 first_bucket; /* index of first bucket used */ + u16 bucket_size; /* sectors */ + u16 group; + u8 state; + u8 replacement; + u8 discard; + u8 data_allowed; + u8 durability; + u8 valid; +}; + +struct bch_replicas_cpu_entry { + u8 data_type; + u8 devs[BCH_SB_MEMBERS_MAX / 8]; +}; + +struct bch_replicas_cpu { + struct rcu_head rcu; + unsigned nr; + unsigned entry_size; + struct bch_replicas_cpu_entry entries[]; +}; + +struct bch_disk_group_cpu { + bool deleted; + u16 parent; + struct bch_devs_mask devs; +}; + +struct bch_disk_groups_cpu { + struct rcu_head rcu; + unsigned nr; + struct bch_disk_group_cpu entries[]; +}; + +#endif /* _BCACHEFS_SUPER_TYPES_H */ -- cgit v1.2.3 From 7a920560d727701c4397a5448085f99bf9f060d5 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 30 Oct 2018 14:14:19 -0400 Subject: bcachefs: kill struct bch_replicas_cpu_entry Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 4d8265bb3154..04a15729a244 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -36,18 +36,6 @@ struct bch_member_cpu { u8 valid; }; -struct bch_replicas_cpu_entry { - u8 data_type; - u8 devs[BCH_SB_MEMBERS_MAX / 8]; -}; - -struct bch_replicas_cpu { - struct rcu_head rcu; - unsigned nr; - unsigned entry_size; - struct bch_replicas_cpu_entry entries[]; -}; - struct bch_disk_group_cpu { bool deleted; u16 parent; -- cgit v1.2.3 From 03e183cb5d429a3bb53816d70da7c19f0745909e Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 21 Mar 2019 23:13:46 -0400 Subject: bcachefs: Verify fs hasn't been modified before going rw Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 04a15729a244..6d0168a73ee4 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -12,6 +12,7 @@ struct bch_sb_handle { unsigned have_layout:1; unsigned have_bio:1; unsigned fs_sb:1; + u64 seq; }; struct bch_devs_mask { -- cgit v1.2.3 From ffb7c3d370a104d14ad0658b359cdf04ae679f04 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 16 Dec 2020 14:23:27 -0500 Subject: bcachefs: Add BCH_BKEY_PTRS_MAX This now means "the maximum number of pointers within a bkey" - and bch_devs_list is updated to use it instead of BCH_REPLICAS_MAX, since stripes can contain more than BCH_REPLICAS_MAX pointers. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 6d0168a73ee4..e3a989e3e9d9 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -21,7 +21,7 @@ struct bch_devs_mask { struct bch_devs_list { u8 nr; - u8 devs[BCH_REPLICAS_MAX + 1]; + u8 devs[BCH_BKEY_PTRS_MAX]; }; struct bch_member_cpu { -- cgit v1.2.3 From 9d8022db1ccfff6aaf1de6158c2a26b667c70a15 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 6 Apr 2021 14:00:56 -0400 Subject: bcachefs: Eliminate more PAGE_SIZE uses In userspace, we don't really have a well defined PAGE_SIZE and shouln't be relying on it. This is some more incremental work to remove references to it. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index e3a989e3e9d9..b14b2d82c655 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -7,7 +7,7 @@ struct bch_sb_handle { struct block_device *bdev; struct bio *bio; void *holder; - unsigned page_order; + size_t buffer_size; fmode_t mode; unsigned have_layout:1; unsigned have_bio:1; -- cgit v1.2.3 From 7243498de74d32d0afe3b923cd893a6b49f70c3c Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 24 Dec 2021 02:55:11 -0500 Subject: bcachefs: Kill non-lru cache replacement policies Prep work for persistent LRUs and getting rid of the in memory bucket array. Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 1 - 1 file changed, 1 deletion(-) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index b14b2d82c655..1c0241304f32 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -30,7 +30,6 @@ struct bch_member_cpu { u16 bucket_size; /* sectors */ u16 group; u8 state; - u8 replacement; u8 discard; u8 data_allowed; u8 durability; -- cgit v1.2.3 From c6b2826cd14c5421bc50a768e923d078a71139c1 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 11 Dec 2021 17:13:09 -0500 Subject: bcachefs: Freespace, need_discard btrees This adds two new btrees for the upcoming allocator rewrite: an extents btree of free buckets, and a btree for buckets awaiting discards. We also add a new trigger for alloc keys to keep the new btrees up to date, and a compatibility path to initialize them on existing filesystems. Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 1c0241304f32..08faeedba326 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -33,6 +33,7 @@ struct bch_member_cpu { u8 discard; u8 data_allowed; u8 durability; + u8 freespace_initialized; u8 valid; }; -- cgit v1.2.3 From c7afec9bd63dc00047c35f9b747aa2be505533e6 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 10 Sep 2023 02:13:33 -0400 Subject: bcachefs: Fix bch_sb_handle type blk_mode_t was recently introduced; we should be using it now, instead of fmode_t. Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 08faeedba326..597a8db73585 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -8,7 +8,7 @@ struct bch_sb_handle { struct bio *bio; void *holder; size_t buffer_size; - fmode_t mode; + blk_mode_t mode; unsigned have_layout:1; unsigned have_bio:1; unsigned fs_sb:1; -- cgit v1.2.3 From c2d81c24123361e5092c88e67d790097308c5b95 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sun, 1 Oct 2023 09:13:54 +0200 Subject: bcachefs: Use struct_size() Use struct_size() instead of hand writing it. This is less verbose and more robust. While at it, prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). Signed-off-by: Christophe JAILLET Signed-off-by: Kent Overstreet --- fs/bcachefs/super_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/bcachefs/super_types.h') diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 597a8db73585..78d6138db62d 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -46,7 +46,7 @@ struct bch_disk_group_cpu { struct bch_disk_groups_cpu { struct rcu_head rcu; unsigned nr; - struct bch_disk_group_cpu entries[]; + struct bch_disk_group_cpu entries[] __counted_by(nr); }; #endif /* _BCACHEFS_SUPER_TYPES_H */ -- cgit v1.2.3