]> www.infradead.org Git - users/willy/pagecache.git/commit
bcachefs: Fix want_new_bset() so we write until the end of the btree node
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 10 Feb 2025 22:46:36 +0000 (17:46 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 11 Feb 2025 15:10:32 +0000 (10:10 -0500)
commit9f734cd076931fa4d7feb5728e5cd95cde0af114
treee7cea71d497a61b9af408bdd9cdce189145682ba
parent1e690efa72596a1163dc56709707f459221889d2
bcachefs: Fix want_new_bset() so we write until the end of the btree node

want_new_bset() returns the address of a new bset to initialize if we
wish to do so in a btree node - either because the previous one is too
big, or because it's been written.

The case for 'previous bset was written' was wrong: it's only supposed
to check for if we have space in the node for one more block, but
because it subtracted the header from the space available it would never
initialize a new bset if we were down to the last block in a node.

Fixing this results in fewer btree node splits/compactions, which fixes
a bug with flushing the journal to go read-only sometimes not
terminating or taking excessively long.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_update_interior.h