[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240324233458.1352854-258-sashal@kernel.org>
Date: Sun, 24 Mar 2024 19:33:57 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: NeilBrown <neilb@...e.de>,
Anna Schumaker <Anna.Schumaker@...app.com>,
Chao Yu <chao@...nel.org>,
"Darrick J . Wong" <djwong@...nel.org>,
Ilya Dryomov <idryomov@...il.com>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Lars Ellenberg <lars.ellenberg@...bit.com>,
Miklos Szeredi <miklos@...redi.hu>,
Paolo Valente <paolo.valente@...aro.org>,
Philipp Reisner <philipp.reisner@...bit.com>,
Ryusuke Konishi <konishi.ryusuke@...il.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Wu Fengguang <fengguang.wu@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.15 257/317] f2fs: replace congestion_wait() calls with io_schedule_timeout()
From: NeilBrown <neilb@...e.de>
[ 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@...e.de>
Cc: Anna Schumaker <Anna.Schumaker@...app.com>
Cc: Chao Yu <chao@...nel.org>
Cc: Darrick J. Wong <djwong@...nel.org>
Cc: Ilya Dryomov <idryomov@...il.com>
Cc: Jaegeuk Kim <jaegeuk@...nel.org>
Cc: Jan Kara <jack@...e.cz>
Cc: Jeff Layton <jlayton@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Lars Ellenberg <lars.ellenberg@...bit.com>
Cc: Miklos Szeredi <miklos@...redi.hu>
Cc: Paolo Valente <paolo.valente@...aro.org>
Cc: Philipp Reisner <philipp.reisner@...bit.com>
Cc: Ryusuke Konishi <konishi.ryusuke@...il.com>
Cc: Trond Myklebust <trond.myklebust@...merspace.com>
Cc: Wu Fengguang <fengguang.wu@...el.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Stable-dep-of: fd244524c2cf ("f2fs: compress: fix to cover normal cluster write with cp_rwsem")
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
fs/f2fs/compress.c | 4 +---
fs/f2fs/data.c | 3 +--
fs/f2fs/f2fs.h | 6 ++++++
fs/f2fs/segment.c | 8 +++-----
fs/f2fs/super.c | 6 ++----
5 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 7b4479d5b5315..c640e4c63909a 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1504,9 +1504,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
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;
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 25dafd1261d71..19b595488a27b 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3158,8 +3158,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
} 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;
}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index e326e7efea391..dfaee211f6133 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4413,6 +4413,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 */
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 5eca50e50e16b..cbdd8d0ec8960 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -313,8 +313,7 @@ void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure)
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 @@ static unsigned int __issue_discard_cmd_range(struct f2fs_sb_info *sbi,
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:
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 5160bf4f4a3ec..df1e5496352c2 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -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 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
&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);
--
2.43.0
Powered by blists - more mailing lists