diff options
Diffstat (limited to 'libbcachefs/movinggc.c')
-rw-r--r-- | libbcachefs/movinggc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libbcachefs/movinggc.c b/libbcachefs/movinggc.c index c306a89f..ad56e039 100644 --- a/libbcachefs/movinggc.c +++ b/libbcachefs/movinggc.c @@ -21,6 +21,7 @@ #include <linux/freezer.h> #include <linux/kthread.h> #include <linux/math64.h> +#include <linux/sched/task.h> #include <linux/sort.h> #include <linux/wait.h> @@ -94,7 +95,8 @@ static enum data_cmd copygc_pred(struct bch_fs *c, void *arg, if (!__copygc_pred(ca, e)) return DATA_SKIP; - data_opts->btree_insert_flags = BTREE_INSERT_USE_RESERVE, + data_opts->target = dev_to_target(ca->dev_idx); + data_opts->btree_insert_flags = BTREE_INSERT_USE_RESERVE; data_opts->rewrite_dev = ca->dev_idx; return DATA_REWRITE; } @@ -178,8 +180,6 @@ static void bch2_copygc(struct bch_fs *c, struct bch_dev *ca) bucket_offset_cmp, NULL); ret = bch2_move_data(c, &ca->copygc_pd.rate, - SECTORS_IN_FLIGHT_PER_DEVICE, - &ca->self, writepoint_ptr(&ca->copygc_write_point), POS_MIN, POS_MAX, copygc_pred, ca, @@ -248,8 +248,10 @@ void bch2_copygc_stop(struct bch_dev *ca) ca->copygc_pd.rate.rate = UINT_MAX; bch2_ratelimit_reset(&ca->copygc_pd.rate); - if (ca->copygc_thread) + if (ca->copygc_thread) { kthread_stop(ca->copygc_thread); + put_task_struct(ca->copygc_thread); + } ca->copygc_thread = NULL; } @@ -269,6 +271,8 @@ int bch2_copygc_start(struct bch_fs *c, struct bch_dev *ca) if (IS_ERR(t)) return PTR_ERR(t); + get_task_struct(t); + ca->copygc_thread = t; wake_up_process(ca->copygc_thread); |