Tim Schlueter
f9ccc30824
bcachefs: Fix bkey_method compilation on gcc 7.3.0
...
Signed-off-by: Tim Schlueter <schlueter.tim@linux.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
06b7345cc2
bcachefs: Include summarized counts in fs_usage
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
5663a41521
bcachefs: refactor bch_fs_usage
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
73e6ab9564
bcachefs: Switch replicas to mark_lock
...
Prep work for upcoming disk accounting changes
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
56e0e7c79f
bcachefs: fix an incorrect bkey_debugcheck() call
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
45dbb73e40
bcachefs: improve extent debugcheck fn
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
641ab73643
bcachefs: improve/clarify ptr_disk_sectors()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
57cb2142ed
bcachefs: Fix for running in degraded mode
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
db636adb2e
bcachefs: Compression fixes
...
regressions from switching disk space accounting to be in compressed
sectors
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
56338d3dc3
bcachefs: propagate BCH_WRITE_CACHED
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
9166b41db1
bcachefs: s/usage_lock/mark_lock
...
better describes what it's for, and we're going to call a new lock
usage_lock
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
76640280ac
bcachefs: New blockcount field for bch_stripe
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:13 -04:00
Kent Overstreet
8eb7f3ee46
bcachefs: move dirty into bucket_mark
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
90541a741d
bcachefs: Add new alloc fields
...
prep work for persistent alloc info
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
3636ed489a
bcachefs: Deferred btree updates
...
Will be used in the future for inode updates, which will be very helpful
for multithreaded workloads that have to update the inode with every
extent update (appends, or updates that change i_sectors)
Also will be used eventually for fully persistent alloc info
However - we still need a mechanism for reserving space in the journal
prior to getting a journal reservation, so it's not technically safe to
make use of this just yet, we could deadlock with the journal full
(although not likely to be an issue in practice)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
eb8632657f
bcachefs: drop bogus percpu_ref_tryget
...
caller should already be guarding against rw, and checking here breaks
when caller needs to finish updates for going RO
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
f0cfb963ec
bcachefs: Track nr_inodes with the key marking machinery
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
26609b619f
bcachefs: Make bkey types globally unique
...
this lets us get rid of a lot of extra switch statements - in a lot of
places we dispatch on the btree node type, and then the key type, so
this is a nice cleanup across a lot of code.
Also improve the on disk format versioning stuff.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
01a0108f01
bcachefs: Fix a btree iter usage error
...
previously, if the code traversed to the next btree node, that could
return an error (due to lock restarts) - which was not being checked
for.
fix is to rework it so it never iterates past the current leaf node, and
pops an assertion if it ever sees an error.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
5b8a9227f8
bcachefs: Split out bkey_sort.c
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
9d11058a78
bcachefs: fix waiting on an open journal entry
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
d034c09b26
bcachefs: return errors correctly from gc
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
eeb83e25bb
bcachefs: Hold usage_lock over mark_key and fs_usage_apply
...
Fixes an inconsistency at the end of gc
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
dfe9bfb32e
bcachefs: Stripes now properly subject to gc
...
gc now verifies the contents of the stripes radix tree, important for
persistent alloc info
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
ad7ae8d63f
bcachefs: Btree locking fix, refactoring
...
Hit an assertion, probably spurious, indicating an iterator was unlocked
when it shouldn't have been (spurious because it wasn't locked at all
when the caller called btree_insert_at()).
Add a flag, BTREE_ITER_NOUNLOCK, and tighten up the assertions
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
Kent Overstreet
de5bb710f9
bcachefs: shim for userspace raid library
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-22 17:08:12 -04:00
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