summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/move.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-30 15:13:09 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-04 22:19:11 -0400
commitf82755e4e8b83a4a98ebd6d819d716547fe11919 (patch)
tree4b91b447e899e17bf0098223e5ad813af6ae776c /fs/bcachefs/move.c
parentc4accde498dd7db8352d574958d19a5f710aba69 (diff)
downloadlinux-stable-f82755e4e8b83a4a98ebd6d819d716547fe11919.tar.gz
linux-stable-f82755e4e8b83a4a98ebd6d819d716547fe11919.tar.bz2
linux-stable-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.c13
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);
}