Skip to content

Commit 10e42b6

Browse files
author
Kent Overstreet
committed
bcachefs: bch2_copygc_wakeup()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent bfbb76e commit 10e42b6

5 files changed

Lines changed: 17 additions & 9 deletions

File tree

fs/bcachefs/movinggc.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
unsigned long bch2_copygc_wait_amount(struct bch_fs *);
66
void bch2_copygc_wait_to_text(struct printbuf *, struct bch_fs *);
77

8+
static inline void bch2_copygc_wakeup(struct bch_fs *c)
9+
{
10+
rcu_read_lock();
11+
struct task_struct *p = rcu_dereference(c->copygc_thread);
12+
if (p)
13+
wake_up_process(p);
14+
rcu_read_unlock();
15+
}
16+
817
void bch2_copygc_stop(struct bch_fs *);
918
int bch2_copygc_start(struct bch_fs *);
1019
void bch2_fs_copygc_init(struct bch_fs *);

fs/bcachefs/rebalance.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ int bch2_set_rebalance_needs_scan(struct bch_fs *c, u64 inum)
262262
int ret = bch2_trans_commit_do(c, NULL, NULL,
263263
BCH_TRANS_COMMIT_no_enospc,
264264
bch2_set_rebalance_needs_scan_trans(trans, inum));
265-
rebalance_wakeup(c);
265+
bch2_rebalance_wakeup(c);
266266
return ret;
267267
}
268268

@@ -664,7 +664,7 @@ void bch2_rebalance_stop(struct bch_fs *c)
664664
c->rebalance.thread = NULL;
665665

666666
if (p) {
667-
/* for sychronizing with rebalance_wakeup() */
667+
/* for sychronizing with bch2_rebalance_wakeup() */
668668
synchronize_rcu();
669669

670670
kthread_stop(p);

fs/bcachefs/rebalance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int bch2_set_rebalance_needs_scan_trans(struct btree_trans *, u64);
3737
int bch2_set_rebalance_needs_scan(struct bch_fs *, u64 inum);
3838
int bch2_set_fs_needs_rebalance(struct bch_fs *);
3939

40-
static inline void rebalance_wakeup(struct bch_fs *c)
40+
static inline void bch2_rebalance_wakeup(struct bch_fs *c)
4141
{
4242
struct task_struct *p;
4343

fs/bcachefs/super.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ static int bch2_dev_attach_bdev(struct bch_fs *c, struct bch_sb_handle *sb)
15001500

15011501
printbuf_exit(&name);
15021502

1503-
rebalance_wakeup(c);
1503+
bch2_rebalance_wakeup(c);
15041504
return 0;
15051505
}
15061506

@@ -1646,7 +1646,7 @@ int __bch2_dev_set_state(struct bch_fs *c, struct bch_dev *ca,
16461646
if (new_state == BCH_MEMBER_STATE_rw)
16471647
__bch2_dev_read_write(c, ca);
16481648

1649-
rebalance_wakeup(c);
1649+
bch2_rebalance_wakeup(c);
16501650

16511651
return ret;
16521652
}

fs/bcachefs/sysfs.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,10 @@ static ssize_t sysfs_opt_store(struct bch_fs *c,
654654
bch2_set_rebalance_needs_scan(c, 0);
655655

656656
if (v && id == Opt_rebalance_enabled)
657-
rebalance_wakeup(c);
657+
bch2_rebalance_wakeup(c);
658658

659-
if (v && id == Opt_copygc_enabled &&
660-
c->copygc_thread)
661-
wake_up_process(c->copygc_thread);
659+
if (v && id == Opt_copygc_enabled)
660+
bch2_copygc_wakeup(c);
662661

663662
if (id == Opt_discard && !ca) {
664663
mutex_lock(&c->sb_lock);

0 commit comments

Comments
 (0)