diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-06 16:26:18 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 11:47:40 -0500 |
commit | 63508b756443cb38e432dea01fec36248cb25cd7 (patch) | |
tree | cbc9df99973f3ccef973b82516655329556d2d98 /fs/bcachefs/super.c | |
parent | 483dea4431240dbd6503dc1b2801e391068ba737 (diff) | |
download | lwn-63508b756443cb38e432dea01fec36248cb25cd7.tar.gz lwn-63508b756443cb38e432dea01fec36248cb25cd7.zip |
bcachefs: c->ro_ref
Add a new refcount for async ops that don't necessarily need the fs to
be RW, with similar lifetime/rules otherwise as c->writes.
To be used by online fsck.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r-- | fs/bcachefs/super.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 8e566c3afcfd..1ec66bb8a63f 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -599,6 +599,9 @@ void __bch2_fs_stop(struct bch_fs *c) bch2_fs_debug_exit(c); bch2_fs_chardev_exit(c); + bch2_ro_ref_put(c); + wait_event(c->ro_ref_wait, !refcount_read(&c->ro_ref)); + kobject_put(&c->counters_kobj); kobject_put(&c->time_stats); kobject_put(&c->opts_dir); @@ -729,6 +732,9 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts) mutex_init(&c->btree_root_lock); INIT_WORK(&c->read_only_work, bch2_fs_read_only_work); + refcount_set(&c->ro_ref, 1); + init_waitqueue_head(&c->ro_ref_wait); + init_rwsem(&c->gc_lock); mutex_init(&c->gc_gens_lock); atomic_set(&c->journal_keys.ref, 1); |