]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: replace congestion_wait() calls with io_schedule_timeout()
authorNeilBrown <neilb@suse.de>
Tue, 22 Mar 2022 21:39:13 +0000 (14:39 -0700)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:21:32 +0000 (18:21 -0400)
[ Upstream commit a64239d0ef345208d8c15d7841a028a43a34c068 ]

As congestion is no longer tracked, congestion_wait() is effectively
equivalent to io_schedule_timeout().

So introduce f2fs_io_schedule_timeout() which sets TASK_UNINTERRUPTIBLE
and call that instead.

Link: https://lkml.kernel.org/r/164549983744.9187.6425865370954230902.stgit@noble.brown
Signed-off-by: NeilBrown <neilb@suse.de>
Cc: Anna Schumaker <Anna.Schumaker@Netapp.com>
Cc: Chao Yu <chao@kernel.org>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Paolo Valente <paolo.valente@linaro.org>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Stable-dep-of: fd244524c2cf ("f2fs: compress: fix to cover normal cluster write with cp_rwsem")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/compress.c
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/segment.c
fs/f2fs/super.c

index 7b4479d5b5315f9b86faaa7eab7f9bf07f4658aa..c640e4c63909a74edc1c388dfbb9b12ae748fb06 100644 (file)
@@ -1504,9 +1504,7 @@ continue_unlock:
                                if (IS_NOQUOTA(cc->inode))
                                        return 0;
                                ret = 0;
-                               cond_resched();
-                               congestion_wait(BLK_RW_ASYNC,
-                                               DEFAULT_IO_TIMEOUT);
+                               f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
                                goto retry_write;
                        }
                        return ret;
index 0294e660eb624557477e1f0d0e238454b94460ec..a03eea4306335581b9da068b8bdfa835576e35a9 100644 (file)
@@ -3157,8 +3157,7 @@ result:
                                } else if (ret == -EAGAIN) {
                                        ret = 0;
                                        if (wbc->sync_mode == WB_SYNC_ALL) {
-                                               cond_resched();
-                                               congestion_wait(BLK_RW_ASYNC,
+                                               f2fs_io_schedule_timeout(
                                                        DEFAULT_IO_TIMEOUT);
                                                goto retry_write;
                                        }
index c712be7d3e59b3964bf2e3a9ad60047a7ba7cff3..a82698ad0d9003c9bf18077b3796b76dc237ba8a 100644 (file)
@@ -4412,6 +4412,12 @@ static inline bool f2fs_block_unit_discard(struct f2fs_sb_info *sbi)
        return F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_BLOCK;
 }
 
+static inline void f2fs_io_schedule_timeout(long timeout)
+{
+       set_current_state(TASK_UNINTERRUPTIBLE);
+       io_schedule_timeout(timeout);
+}
+
 #define EFSBADCRC      EBADMSG         /* Bad CRC detected */
 #define EFSCORRUPTED   EUCLEAN         /* Filesystem is corrupted */
 
index 5eca50e50e16badf7170097c0a2377cb93c4192c..cbdd8d0ec89607e54564b8431f6accdea109f626 100644 (file)
@@ -313,8 +313,7 @@ next:
 skip:
                iput(inode);
        }
-       congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT);
-       cond_resched();
+       f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
        if (gc_failure) {
                if (++looped >= count)
                        return;
@@ -789,8 +788,7 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi)
                do {
                        ret = __submit_flush_wait(sbi, FDEV(i).bdev);
                        if (ret)
-                               congestion_wait(BLK_RW_ASYNC,
-                                               DEFAULT_IO_TIMEOUT);
+                               f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
                } while (ret && --count);
 
                if (ret) {
@@ -3106,7 +3104,7 @@ next:
                        blk_finish_plug(&plug);
                        mutex_unlock(&dcc->cmd_lock);
                        trimmed += __wait_all_discard_cmd(sbi, NULL);
-                       congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT);
+                       f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
                        goto next;
                }
 skip:
index 5160bf4f4a3ecb281efb65220803fa5a6399562f..df1e5496352c210e41066b564e33dc31f1ac25a3 100644 (file)
@@ -2168,8 +2168,7 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
        /* we should flush all the data to keep data consistency */
        do {
                sync_inodes_sb(sbi->sb);
-               cond_resched();
-               congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT);
+               f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
        } while (get_pages(sbi, F2FS_DIRTY_DATA) && retry--);
 
        if (unlikely(retry < 0))
@@ -2540,8 +2539,7 @@ retry:
                                                        &page, &fsdata);
                if (unlikely(err)) {
                        if (err == -ENOMEM) {
-                               congestion_wait(BLK_RW_ASYNC,
-                                               DEFAULT_IO_TIMEOUT);
+                               f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
                                goto retry;
                        }
                        set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR);