bcachefs: Move extent overwrite handling out of core btree code
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 30 Dec 2019 19:37:25 +0000 (14:37 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:36 +0000 (17:08 -0400)
commite3e464ac6d09269b19cea3dc32b626db44d0e6ba
tree7aafd377933161ed88573a5e3dab7ee3d8e0e06a
parent57b0b3db475de6b724e4db3b827c00484cdde642
bcachefs: Move extent overwrite handling out of core btree code

Ever since the btree code was first written, handling of overwriting
existing extents - including partially overwriting and splittin existing
extents - was handled as part of the core btree insert path. The modern
transaction and iterator infrastructure didn't exist then, so that was
the only way for it to be done.

This patch moves that outside of the core btree code to a pass that runs
at transaction commit time.

This is a significant simplification to the btree code and overall
reduction in code size, but more importantly it gets us much closer to
the core btree code being completely independent of extents and is
important prep work for snapshots.

This introduces a new feature bit; the old and new extent update models
are incompatible when the filesystem needs journal replay.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
15 files changed:
fs/bcachefs/bcachefs_format.h
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_io.c
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_types.h
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update_interior.h
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/buckets.c
fs/bcachefs/buckets.h
fs/bcachefs/extent_update.c
fs/bcachefs/extent_update.h
fs/bcachefs/fsck.c
fs/bcachefs/recovery.c
fs/bcachefs/recovery.h