summaryrefslogtreecommitdiff
path: root/libbcachefs/move.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-02 14:39:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-02 14:39:01 -0400
commit0a08ddf78c9cf4b6671ba64b049c37da64233f4f (patch)
tree5c373e315fd49da181fdf0b06ff6ba0fffe5dccf /libbcachefs/move.c
parentd320a4e927fd706b34c714b77130965a385ea4fb (diff)
Update bcachefs sources to b9bd69421f73 bcachefs: x-macro-ify inode flags enumv1.3.1
Diffstat (limited to 'libbcachefs/move.c')
-rw-r--r--libbcachefs/move.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libbcachefs/move.c b/libbcachefs/move.c
index 1b15b010..ab749bf2 100644
--- a/libbcachefs/move.c
+++ b/libbcachefs/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);
}