diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-09 12:21:45 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:50 -0400 |
commit | d94189ad568f6cbd80d372cf7aa6e4898b6c5c17 (patch) | |
tree | 4e23dbd00746c19092bcdb8604903cab7049a83b /fs/bcachefs/btree_update_interior.c | |
parent | dd81a060eb0680e09d133b81db54b90442c32b5e (diff) | |
download | linux-d94189ad568f6cbd80d372cf7aa6e4898b6c5c17.tar.gz linux-d94189ad568f6cbd80d372cf7aa6e4898b6c5c17.tar.bz2 linux-d94189ad568f6cbd80d372cf7aa6e4898b6c5c17.zip |
bcachefs: Debug mode for c->writes references
This adds a debug mode where we split up the c->writes refcount into
distinct refcounts for every codepath that takes a reference, and adds
sysfs code to print the value of each ref.
This will make it easier to debug shutdown hangs due to refcount leaks.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update_interior.c')
-rw-r--r-- | fs/bcachefs/btree_update_interior.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index 4e9c963dbd23..6287e926f605 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -2036,7 +2036,7 @@ void async_btree_node_rewrite_work(struct work_struct *work) bch2_trans_do(c, NULL, NULL, 0, async_btree_node_rewrite_trans(&trans, a)); - percpu_ref_put(&c->writes); + bch2_write_ref_put(c, BCH_WRITE_REF_node_rewrite); kfree(a); } @@ -2044,12 +2044,12 @@ void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b) { struct async_btree_rewrite *a; - if (!percpu_ref_tryget_live(&c->writes)) + if (!bch2_write_ref_tryget(c, BCH_WRITE_REF_node_rewrite)) return; a = kmalloc(sizeof(*a), GFP_NOFS); if (!a) { - percpu_ref_put(&c->writes); + bch2_write_ref_put(c, BCH_WRITE_REF_node_rewrite); return; } |