Commit 10e42b6f authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: bch2_copygc_wakeup()

parent bfbb76ec
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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 *);
+2 −2
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;

+2 −2
Original line number Diff line number Diff line
@@ -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;
}
+3 −4
Original line number Diff line number Diff line
@@ -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);