diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-30 20:13:09 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-05 03:19:11 +0100 |
commit | f82755e4e8b83a4a98ebd6d819d716547fe11919 (patch) | |
tree | 4b91b447e899e17bf0098223e5ad813af6ae776c /fs/bcachefs/move.c | |
parent | bcachefs: Ensure srcu lock is not held too long (diff) | |
download | linux-f82755e4e8b83a4a98ebd6d819d716547fe11919.tar.xz linux-f82755e4e8b83a4a98ebd6d819d716547fe11919.zip |
bcachefs: Data move path now uses bch2_trans_unlock_long()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/move.c')
-rw-r--r-- | fs/bcachefs/move.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 1b15b010461a..ab749bf2fcbc 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -147,9 +147,8 @@ void bch2_moving_ctxt_do_pending_writes(struct moving_context *ctxt) { struct moving_io *io; - bch2_trans_unlock(ctxt->trans); - while ((io = bch2_moving_ctxt_next_pending_write(ctxt))) { + bch2_trans_unlock_long(ctxt->trans); list_del(&io->read_list); move_write(io); } @@ -485,8 +484,8 @@ int bch2_move_ratelimit(struct moving_context *ctxt) struct bch_fs *c = ctxt->trans->c; u64 delay; - if (ctxt->wait_on_copygc) { - bch2_trans_unlock(ctxt->trans); + if (ctxt->wait_on_copygc && !c->copygc_running) { + bch2_trans_unlock_long(ctxt->trans); wait_event_killable(c->copygc_running_wq, !c->copygc_running || kthread_should_stop()); @@ -495,8 +494,12 @@ int bch2_move_ratelimit(struct moving_context *ctxt) do { delay = ctxt->rate ? bch2_ratelimit_delay(ctxt->rate) : 0; + if (delay) { - bch2_trans_unlock(ctxt->trans); + if (delay > HZ / 10) + bch2_trans_unlock_long(ctxt->trans); + else + bch2_trans_unlock(ctxt->trans); set_current_state(TASK_INTERRUPTIBLE); } |