]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: enumerated_ref.c
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 18 Apr 2025 18:56:09 +0000 (14:56 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:14:27 +0000 (20:14 -0400)
commitf5241e41272858b983da45ac7f8a6ad58c4ba71f
tree41896969272a866496b097c20d796921795a0307
parent6d67de1079993e09e7a867a6936a8163ece98792
bcachefs: enumerated_ref.c

Factor out the debug code for rw filesystem refs into a small library.

In release mode an enumerated ref is a normal percpu refcount, but in
debug mode all enumerated users of the ref get their own atomic_long_t
ref - making it much easier to chase down refcount usage bugs for when a
refcount has many users.

For debugging, we have enumerated_ref_to_text(), which prints the
current value of each different user.

Additionally, in debug mode enumerated_ref_stop() has a 10 second
timeout, after which it will dump outstanding refcounts.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/Makefile
fs/bcachefs/enumerated_ref.c [new file with mode: 0644]
fs/bcachefs/enumerated_ref.h [new file with mode: 0644]
fs/bcachefs/enumerated_ref_types.h [new file with mode: 0644]