]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: Disk space accounting rewrite
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 9 Nov 2023 19:22:46 +0000 (14:22 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:13 +0000 (19:00 -0400)
commit1d16c605cc55ef26f0c65b362665a6c99080ccbc
treec7f7f6b6209ac290185dbea26a1f9d59661ac95f
parent5d9667d1d6eaca3f6cd3c63cd6a0f309147c7f5c
bcachefs: Disk space accounting rewrite

Main part of the disk accounting rewrite.

This is a wholesale rewrite of the existing disk space accounting, which
relies on percepu counters that are sharded by journal buffer, and
rolled up and added to each journal write.

With the new scheme, every set of counters is a distinct key in the
accounting btree; this fixes scaling limitations of the old scheme,
where counters took up space in each journal entry and required multiple
percpu counters.

Now, in memory accounting requires a single set of percpu counters - not
multiple for each in flight journal buffer - and in the future we'll
probably also have counters that don't use in memory percpu counters,
they're not strictly required.

An accounting update is now a normal btree update, using the btree write
buffer path. At transaction commit time, we apply accounting updates to
the in memory counters, which are percpu counters indexed in an
eytzinger tree by the accounting key.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
25 files changed:
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.h
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_ioctl.h
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_trans_commit.c
fs/bcachefs/btree_types.h
fs/bcachefs/btree_update.h
fs/bcachefs/buckets.c
fs/bcachefs/buckets.h
fs/bcachefs/disk_accounting.c
fs/bcachefs/disk_accounting.h
fs/bcachefs/disk_accounting_format.h
fs/bcachefs/disk_accounting_types.h [new file with mode: 0644]
fs/bcachefs/ec.c
fs/bcachefs/inode.c
fs/bcachefs/recovery.c
fs/bcachefs/recovery_passes.c
fs/bcachefs/recovery_passes_types.h
fs/bcachefs/replicas.c
fs/bcachefs/replicas.h
fs/bcachefs/replicas_types.h
fs/bcachefs/super.c