summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-09 12:21:45 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:50 -0400
commitd94189ad568f6cbd80d372cf7aa6e4898b6c5c17 (patch)
tree4e23dbd00746c19092bcdb8604903cab7049a83b /fs/bcachefs/super.h
parentdd81a060eb0680e09d133b81db54b90442c32b5e (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/super.h')
-rw-r--r--fs/bcachefs/super.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/super.h b/fs/bcachefs/super.h
index d66de6f589ac..5e6fbbfd2d43 100644
--- a/fs/bcachefs/super.h
+++ b/fs/bcachefs/super.h
@@ -250,7 +250,8 @@ int bch2_fs_read_write_early(struct bch_fs *);
*/
static inline void bch2_fs_lazy_rw(struct bch_fs *c)
{
- if (percpu_ref_is_zero(&c->writes))
+ if (!test_bit(BCH_FS_RW, &c->flags) &&
+ !test_bit(BCH_FS_WAS_RW, &c->flags))
bch2_fs_read_write_early(c);
}