Skip to content

enumarated refcounts, for debugging refcount issues

Kent Overstreet linux-bcachefs linux-fsdevel linux-hardening lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bcachefs: enumerated_ref.cfs/bcachefs/Makefile fs/bcachefs/enumerated_ref.c fs/bcachefs/enumerated_ref.h +1 more+218 -00 replies
2/3bcachefs: bch_fs.writes -> enumerated_refsfs/bcachefs/alloc_background.c fs/bcachefs/bcachefs.h fs/bcachefs/btree_gc.c +15 more+87 -1530 replies
3/3bcachefs: bch_dev.io_ref -> enumerated_reffs/bcachefs/alloc_background.c fs/bcachefs/backpointers.c fs/bcachefs/bcachefs.h +17 more+236 -1360 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] enumarated refcounts, for debugging refcount issues

Not sure we have a list for library code, but this might be of interest to anyone who's had to debug refcount issues on refs with lots of users (filesystem people), and I know the hardening folks deal with refcounts a lot.

In release mode, this is just a wrapper around percpu refcounts.

In debug mode, this provides separate sub-refcounts for each enumerated user, and provides facilities for printing them.

Meaning, if you're debugging a refcount issue, you no longer have to go searching through the entire codebase - it'll tell you the exact codepath.

bcachefs patches are provided as example usage, for other subsystems.

Kent Overstreet (3):
bcachefs: enumerated_ref.c
bcachefs: bch_fs.writes -> enumerated_refs
bcachefs: bch_dev.io_ref -> enumerated_ref

 fs/bcachefs/Makefile                |   1 +
 fs/bcachefs/alloc_background.c      |  41 ++++----
 fs/bcachefs/backpointers.c          |   6 +-
 fs/bcachefs/bcachefs.h              | 105 ++++++++++----------
 fs/bcachefs/btree_gc.c              |   7 +-
 fs/bcachefs/btree_io.c              |  29 +++---
 fs/bcachefs/btree_node_scan.c       |  10 +-
 fs/bcachefs/btree_trans_commit.c    |   5 +-
 fs/bcachefs/btree_update_interior.c |   7 +-
 fs/bcachefs/btree_write_buffer.c    |  11 ++-
 fs/bcachefs/buckets.c               |   4 +-
 fs/bcachefs/debug.c                 |  12 ++-
 fs/bcachefs/ec.c                    |  32 ++++---
 fs/bcachefs/enumerated_ref.c        | 144 ++++++++++++++++++++++++++++
 fs/bcachefs/enumerated_ref.h        |  66 +++++++++++++
 fs/bcachefs/enumerated_ref_types.h  |  19 ++++
 fs/bcachefs/fs-io-direct.c          |   7 +-
 fs/bcachefs/fs-io.c                 |  15 +--
 fs/bcachefs/io_read.c               |  17 ++--
 fs/bcachefs/io_write.c              |  20 ++--
 fs/bcachefs/journal.c               |  10 +-
 fs/bcachefs/journal_io.c            |  15 +--
 fs/bcachefs/journal_reclaim.c       |   2 +-
 fs/bcachefs/reflink.c               |   5 +-
 fs/bcachefs/sb-members.h            |  32 ++++---
 fs/bcachefs/snapshot.c              |   7 +-
 fs/bcachefs/subvolume.c             |   7 +-
 fs/bcachefs/super-io.c              |  18 ++--
 fs/bcachefs/super.c                 | 125 +++++++++++-------------
 fs/bcachefs/super.h                 |   3 +
 fs/bcachefs/sysfs.c                 |  46 ++++-----
 31 files changed, 540 insertions(+), 288 deletions(-)
 create mode 100644 fs/bcachefs/enumerated_ref.c
 create mode 100644 fs/bcachefs/enumerated_ref.h
 create mode 100644 fs/bcachefs/enumerated_ref_types.h
Signature · 1 line
2.49.0