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
Kent Overstreet
34b8e55276
bcachefs: Fix a deadlock
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
cf0517af15
bcachefs: fix a divide
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
bc230209d3
bcachefs: make fsck spew less
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
741daa5be5
bcachefs: Dirent repair code
...
There was a bug for awhile in previous kernels where we weren't
computing dirent name lengths correctly and we weren't zeroing out
padding at the end of dirents (due to struct bch_dirent changing size by
adding __attribute__((aligned)), and not updating other code to use
offsetof).
This patch fixes dirents with junk at the end, by going off of the
dirent's hash.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
cbdf24cef1
bcachefs: Fix a btree iter bug when iter pos == POS_MAX
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
a00fd8c535
bcachefs: Comparison function cleanups
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
f84306a570
bcachefs: Prioritize fragmentation in bucket allocator
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
216c9facfd
bcachefs: Pass around bset_tree less
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
fc3268c13c
bcachefs: kill extent_insert_hook
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
190fa7af39
bcachefs: kill i_sectors_hook
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
8ef231bd51
bcachefs: convert fcollapse to bch2_extent_update()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
5f461e01b8
bcachefs: convert fpunch to bch2_extent_update()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
54e2264e17
bcachefs: convert truncate to bch2_extent_update()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
08af47dfc2
bcachefs: convert bchfs_write_index_update() to bch2_extent_update()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
e2d9912c6f
bcachefs: bch2_extent_trim_atomic()
...
Prep work for extents insert hook removal
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
581edb6341
bcachefs: mempoolify btree_trans
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
cc1add4a80
bcachefs: BTREE_INSERT_JOURNAL_RES_FULL is no longer possible
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
df8a42393e
bcachefs: extent_squash() can no longer fail
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
e4ccb25131
bcachefs: make struct btree_iter a bit smaller
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
271a3d3a4b
bcachefs: lift ordering restriction on 0 size extents
...
This lifts the restriction that 0 size extents must not overlap with
other extents, which means we can now sort extents and non extents the
same way, and will let us simplify a bunch of other stuff as well.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:09 -04:00
Kent Overstreet
0fdf18047f
bcachefs: extent unit tests
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
1fe08f31b2
bcachefs: bkey_written()
...
also cleanups of btree node offsets
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
617391baa5
bcachefs: improved rw_aux_tree_bsearch()
...
shouldn't be any reason for an actual binary search here
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
b0004d8dfa
bcachefs: Factor out btree_key_can_insert()
...
working on getting rid of all the reasons bch2_insert_fixup_extent() can
fail/stop partway, which is needed for other refactorings.
One of the reasons we could have to bail out is if we're splitting a
compressed extent we might need to add to our disk reservation - but we
can check that before actually starting the insert.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
a50ed7c8e8
bcachefs: BCH_SB_RESERVE_BYTES
...
Add an option, gc_reserve_bytes, to set the copygc reserve as a size
instead of a percent
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
a9bec5208b
bcachefs: Better calculation of copygc threshold
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
6eac2c2e24
bcachefs: Change how replicated data is accounted
...
Due to compression, the different replicas of a replicated extent don't
necessarily have to take up the same amount of space - so replicated
data sector counts shouldn't be stored divided by the number of
replicas.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
5b650fd11a
bcachefs: Account for internal fragmentation better
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
09f3297ac9
bcachefs: kill s_alloc, use bch_data_type
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
a7c7a3092e
bcachefs: bch2_mark_key() now takes bch_data_type
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00
Kent Overstreet
647d7b60b1
bcachefs: Fix an assertion in the btree node merge path
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev >
2023-10-22 17:08:08 -04:00