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/fs-io.c | |
parent | dd81a060eb0680e09d133b81db54b90442c32b5e (diff) |
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/fs-io.c')
-rw-r--r-- | fs/bcachefs/fs-io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 378cca413c75..944fffd9f7b5 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -3231,7 +3231,7 @@ long bch2_fallocate_dispatch(struct file *file, int mode, struct bch_fs *c = inode->v.i_sb->s_fs_info; long ret; - if (!percpu_ref_tryget_live(&c->writes)) + if (!bch2_write_ref_tryget(c, BCH_WRITE_REF_fallocate)) return -EROFS; inode_lock(&inode->v); @@ -3255,7 +3255,7 @@ long bch2_fallocate_dispatch(struct file *file, int mode, err: bch2_pagecache_block_put(inode); inode_unlock(&inode->v); - percpu_ref_put(&c->writes); + bch2_write_ref_put(c, BCH_WRITE_REF_fallocate); return bch2_err_class(ret); } |