Kent Overstreet
4e65431c85
Revert "bcachefs: start erasure coding after journal replay"
...
This reverts commit 36f389604294dfc953e6f5624ceb683818d32f28.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
e88973373a
bcachefs: Allow for new alloc fields
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
9ca53b55f7
bcachefs: gc now operates on second set of bucket marks
...
This means we can now use gc to verify the allocation information -
important for testing persistant alloc info
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
e647369168
bcachefs: fix mempool double initialization
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
8812600c29
bcachefs: fix btree iterator bug when using depth > 0
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
61274e9d45
bcachefs: Allocator startup improvements
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
a9ec345401
bcachefs: Journal refactoring
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
f1a79365a7
bcachefs: Don't block on journal reservation with btree locks held
...
Fixes a deadlock between the allocator thread, when it first starts up,
and journal replay
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
129550c4d0
bcachefs: start erasure coding after journal replay
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
f81b648d1f
bcachefs: Clean up, possixly fix page disk reservation accounting
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
b1ba2359fb
bcachefs: Fix an error path
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
283cca30a8
bcachefs: fix typo when picking read method
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
cd575ddf57
bcachefs: Erasure coding
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
91f8b5677b
bcachefs: More btree gc refactorings
...
more prep work for erasure coding
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
1d25849c2c
bcachefs: Centralize marking of replicas in btree update path
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
b35b192583
bcachefs: Move key marking out of extents.c
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
af9d3bc203
bcachefs: stripe support for replicas tracking
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
c258f28eba
bcachefs: Check for unsupported features
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
319f9ac38e
bcachefs: revamp to_text methods
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
75369d4ec3
bcachefs: delete some dead code
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
82ebd49cd6
bcachefs: fix a replicas bug
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Tim Schlueter
a420eea689
bcachefs: Set the last mount time using the realtime clock
...
This way the last mount time is actually meaningful instead of just being
various times from 1970 (which happens with the monotonic clock).
Also, roundup_pow_of_two() is undefined when passed in 0, so check before
calling it.
Signed-off-by: Tim Schlueter <schlueter.tim@linux.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
4628529f15
bcachefs: Disk usage in compressed sectors, not uncompressed
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
8b335baef2
bcachefs: Assorted fixes for running on very small devices
...
It's now possible to create and use a filesystem on a 512k device with
4k buckets (though at that size we still waste almost half to internal
reserves)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
b092dadd55
bcachefs: Scale down number of writepoints when low on space
...
this means we don't have to reserve space for them when calculating
filesystem capacity
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
72644db153
bcachefs: Fix an assertion when rebuilding replicas
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
02f1a96c13
bcachefs: Rename nofsck opt to fsck
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
6bdbfa87a8
bcachefs: Fix journal replay when replicas sb section missing
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:11 -04:00
Kent Overstreet
636ad1d391
bcachefs: fix bounds checks in bch2_bio_map()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
ac10a9611d
bcachefs: Some fixes for building in userspace
...
userspace allocators don't align allocations as nicely as kernel
allocators, which meant that in some cases we weren't allocating big
enough bvec arrays - just make the calculations more rigorous and
explicit to fix it.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
b564513cf9
bcachefs: fix bch2_bkey_print_bfloat
...
was popping an assertion in the eytzinger code
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
5bd95a3718
bcachefs: new avoid mechanism for io retries
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
47799326bc
bcachefs: more key marking refactoring
...
prep work for erasure coding
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
103e212785
bcachefs: replicas: prep work for stripes
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
7a920560d7
bcachefs: kill struct bch_replicas_cpu_entry
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
198d67006b
bcachefs: add functionality for heaps to update backpointers
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
2252aa271c
bcachefs: btree gc refactoring
...
prep work for erasure coding
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
abce30b79b
bcachefs: BCH_EXTENT_ENTRY_TYPES()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
71c9e0ba42
bcachefs: bch2_extent_ptr_decoded_append()
...
This new helper for the move path avoids creating a new CRC entry when
we already have one that matches the pointer being added.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
a2753581f6
bcachefs: bch2_extent_drop_ptrs()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
1742237ba1
bcachefs: extent_for_each_ptr_decode()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
642d66d1bb
bcachefs: kill bch_extent_crc_type
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
4cb1315666
bcachefs: extent_ptr_decoded
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
deb3318b0e
bcachefs: fix missing include
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
6278a46da3
bcachefs: fix a spurious gcc warning
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
ef337c54c6
bcachefs: Allocation code refactoring
...
bch2_alloc_sectors_start() was a nightmare to work with - it's got some
tricky stuff to do, since it wants to use the buckets the writepoint
already has, unless they're not in the target it wants to write to,
unless it can't allocate from any other devices in which case it will
use those buckets if it has to - et cetera.
This restructures the code to start with a new empty list of open
buckets we're going to use for the new allocation, pulling buckets from
the write point's list as we decide that we really are going to use
them - making the code somewhat more functional and drastically easier
to understand.
Also fixes a bug where we could end up waiting on c->freelist_wait
(because allocating from one device failed) but return success from
bch2_bucket_alloc(), because allocating from a different device
succeeded.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
7b3f84ea7d
bcachefs: Split out alloc_background.c
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
f43cc5be6e
bcachefs: Fix failure to suspend
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
c2fcff5973
bcachefs: Fix suspend when moving data faster than ratelimit
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:10 -04:00
Kent Overstreet
d06182cadb
bcachefs: fix bch2_acl_chmod()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:09 -04:00