reiserfs: don't use congestion_wait()
authorNeilBrown <neilb@suse.de>
Wed, 17 Nov 2021 04:34:42 +0000 (15:34 +1100)
committerJan Kara <jack@suse.cz>
Thu, 18 Nov 2021 10:52:22 +0000 (11:52 +0100)
Block devices do not, in general, report congestion any more, so this
congestion_wait() is effectively just a sleep.

It isn't entirely clear what is being waited for, but as we only wait
when j_async_throttle is elevated, it seems reasonable to stop waiting
when j_async_throttle becomes zero - or after the same timeout.

So change to use wait_event_event_timeout() for waiting, and
wake_up_var() to signal an end to waiting.

Link: https://lore.kernel.org/r/163712368225.13692.3419908086400748349@noble.neil.brown.name
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/reiserfs/journal.c

index 0834b10..a3e2116 100644 (file)
@@ -951,7 +951,9 @@ static int reiserfs_async_progress_wait(struct super_block *s)
                int depth;
 
                depth = reiserfs_write_unlock_nested(s);
-               congestion_wait(BLK_RW_ASYNC, HZ / 10);
+               wait_var_event_timeout(&j->j_async_throttle,
+                                      atomic_read(&j->j_async_throttle) == 0,
+                                      HZ / 10);
                reiserfs_write_lock_nested(s, depth);
        }
 
@@ -1058,7 +1060,8 @@ static int flush_commit_list(struct super_block *s,
                        put_bh(tbh) ;
                }
        }
-       atomic_dec(&journal->j_async_throttle);
+       if (atomic_dec_and_test(&journal->j_async_throttle))
+               wake_up_var(&journal->j_async_throttle);
 
        for (i = 0; i < (jl->j_len + 1); i++) {
                bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) +