bcachefs: bch2_copygc_wakeup()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-04-15 10:26:05 -04:00
parent bfbb76ec98
commit 10e42b6f25
5 changed files with 17 additions and 9 deletions

View File

@ -5,6 +5,15 @@
unsigned long bch2_copygc_wait_amount(struct bch_fs *);
void bch2_copygc_wait_to_text(struct printbuf *, struct bch_fs *);
static inline void bch2_copygc_wakeup(struct bch_fs *c)
{
rcu_read_lock();
struct task_struct *p = rcu_dereference(c->copygc_thread);
if (p)
wake_up_process(p);
rcu_read_unlock();
}
void bch2_copygc_stop(struct bch_fs *);
int bch2_copygc_start(struct bch_fs *);
void bch2_fs_copygc_init(struct bch_fs *);

View File

@ -262,7 +262,7 @@ int bch2_set_rebalance_needs_scan(struct bch_fs *c, u64 inum)
int ret = bch2_trans_commit_do(c, NULL, NULL,
BCH_TRANS_COMMIT_no_enospc,
bch2_set_rebalance_needs_scan_trans(trans, inum));
rebalance_wakeup(c);
bch2_rebalance_wakeup(c);
return ret;
}
@ -664,7 +664,7 @@ void bch2_rebalance_stop(struct bch_fs *c)
c->rebalance.thread = NULL;
if (p) {
/* for sychronizing with rebalance_wakeup() */
/* for sychronizing with bch2_rebalance_wakeup() */
synchronize_rcu();
kthread_stop(p);

View File

@ -37,7 +37,7 @@ int bch2_set_rebalance_needs_scan_trans(struct btree_trans *, u64);
int bch2_set_rebalance_needs_scan(struct bch_fs *, u64 inum);
int bch2_set_fs_needs_rebalance(struct bch_fs *);
static inline void rebalance_wakeup(struct bch_fs *c)
static inline void bch2_rebalance_wakeup(struct bch_fs *c)
{
struct task_struct *p;

View File

@ -1500,7 +1500,7 @@ static int bch2_dev_attach_bdev(struct bch_fs *c, struct bch_sb_handle *sb)
printbuf_exit(&name);
rebalance_wakeup(c);
bch2_rebalance_wakeup(c);
return 0;
}
@ -1646,7 +1646,7 @@ int __bch2_dev_set_state(struct bch_fs *c, struct bch_dev *ca,
if (new_state == BCH_MEMBER_STATE_rw)
__bch2_dev_read_write(c, ca);
rebalance_wakeup(c);
bch2_rebalance_wakeup(c);
return ret;
}

View File

@ -654,11 +654,10 @@ static ssize_t sysfs_opt_store(struct bch_fs *c,
bch2_set_rebalance_needs_scan(c, 0);
if (v && id == Opt_rebalance_enabled)
rebalance_wakeup(c);
bch2_rebalance_wakeup(c);
if (v && id == Opt_copygc_enabled &&
c->copygc_thread)
wake_up_process(c->copygc_thread);
if (v && id == Opt_copygc_enabled)
bch2_copygc_wakeup(c);
if (id == Opt_discard && !ca) {
mutex_lock(&c->sb_lock);