]> www.infradead.org Git - users/hch/dma-mapping.git/commit
bcachefs: fix restart handling in bch2_alloc_write_key()
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 16 Oct 2024 07:36:40 +0000 (03:36 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 18 Oct 2024 04:49:47 +0000 (00:49 -0400)
commitd8b50597748d6d960c936c89b972516c5e39ee96
tree5cc2529c2b90cac5d199ddbd7da59e5185d84d76
parent7ee4be9c621e4cd6a87d134a46d7c56debdf6664
bcachefs: fix restart handling in bch2_alloc_write_key()

This is ugly:

We may discover in alloc_write_key that the data type we calculated is
wrong, because BCH_DATA_need_discard is checked/set elsewhere, and the
disk accounting counters we calculated need to be updated.

But bch2_alloc_key_to_dev_counters(..., BTREE_TRIGGER_gc) is not safe
w.r.t. transaction restarts, so we need to propagate the fixup back to
our gc state in case we take a transaction restart.

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