summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-30 00:14:06 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:35 +0300
commit7c0732b88dfb87b5f32dcf5fdd7984d2acb992b9 (patch)
tree8e40740959c28f807ad2c5169bec79a14342cbce /fs/bcachefs
parent4081ace307c15fb0c15bcc65fce2e3792c1979d9 (diff)
downloadlinux-7c0732b88dfb87b5f32dcf5fdd7984d2acb992b9.tar.xz
bcachefs: Fix move path when move_stats == NULL
This isn't done very often, but it is legitimate Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/move.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index eae93c65e1c7..8b44d95c32ce 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -140,13 +140,15 @@ void bch2_moving_ctxt_exit(struct moving_context *ctxt)
{
move_ctxt_wait_event(ctxt, NULL, list_empty(&ctxt->reads));
closure_sync(&ctxt->cl);
- progress_list_del(ctxt->c, ctxt->stats);
-
EBUG_ON(atomic_read(&ctxt->write_sectors));
- trace_move_data(ctxt->c,
- atomic64_read(&ctxt->stats->sectors_moved),
- atomic64_read(&ctxt->stats->keys_moved));
+ if (ctxt->stats) {
+ progress_list_del(ctxt->c, ctxt->stats);
+
+ trace_move_data(ctxt->c,
+ atomic64_read(&ctxt->stats->sectors_moved),
+ atomic64_read(&ctxt->stats->keys_moved));
+ }
}
void bch2_moving_ctxt_init(struct moving_context *ctxt,
@@ -164,13 +166,14 @@ void bch2_moving_ctxt_init(struct moving_context *ctxt,
ctxt->wp = wp;
ctxt->wait_on_copygc = wait_on_copygc;
- progress_list_add(c, stats);
closure_init_stack(&ctxt->cl);
INIT_LIST_HEAD(&ctxt->reads);
init_waitqueue_head(&ctxt->wait);
- if (stats)
+ if (stats) {
+ progress_list_add(c, stats);
stats->data_type = BCH_DATA_user;
+ }
}
void bch_move_stats_init(struct bch_move_stats *stats, char *name)