bcachefs: Log truncate operations
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 10 Sep 2023 20:42:30 +0000 (16:42 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:12 +0000 (17:10 -0400)
commitb030e262b517b6bddc4bfa88ed8d335ef9de7671
treeb0a1aea8f9773b926352e091f9d4a2c8ef31fcf5
parentaaad530ac6b1c836de4a29d227ab68be97e39a73
bcachefs: Log truncate operations

Previously, we guaranteed atomicity of truncate after unclean shutdown
with the BCH_INODE_I_SIZE_DIRTY flag - which required a full scan of the
inodes btree.

Recently the deleted inodes btree was added so that we no longer have to
scan for deleted inodes, but truncate was unfinished and that change
left it broken.

This patch uses the new logged operations btree to fix truncate
atomicity; we now log an operation that can be replayed at the start of
a truncate.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bkey_methods.c
fs/bcachefs/io_misc.c
fs/bcachefs/io_misc.h
fs/bcachefs/logged_ops.c
fs/bcachefs/logged_ops.h