Commit a64239d0 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

f2fs: replace congestion_wait() calls with io_schedule_timeout()

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.brownSigned-off-by: default avatarNeilBrown <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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b9b1335e
...@@ -1505,9 +1505,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc, ...@@ -1505,9 +1505,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
if (IS_NOQUOTA(cc->inode)) if (IS_NOQUOTA(cc->inode))
return 0; return 0;
ret = 0; ret = 0;
cond_resched(); f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
congestion_wait(BLK_RW_ASYNC,
DEFAULT_IO_TIMEOUT);
goto retry_write; goto retry_write;
} }
return ret; return ret;
......
...@@ -3047,8 +3047,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, ...@@ -3047,8 +3047,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
} else if (ret == -EAGAIN) { } else if (ret == -EAGAIN) {
ret = 0; ret = 0;
if (wbc->sync_mode == WB_SYNC_ALL) { if (wbc->sync_mode == WB_SYNC_ALL) {
cond_resched(); f2fs_io_schedule_timeout(
congestion_wait(BLK_RW_ASYNC,
DEFAULT_IO_TIMEOUT); DEFAULT_IO_TIMEOUT);
goto retry_write; goto retry_write;
} }
......
...@@ -4426,6 +4426,12 @@ static inline bool f2fs_block_unit_discard(struct f2fs_sb_info *sbi) ...@@ -4426,6 +4426,12 @@ static inline bool f2fs_block_unit_discard(struct f2fs_sb_info *sbi)
return F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_BLOCK; 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 EFSBADCRC EBADMSG /* Bad CRC detected */
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
......
...@@ -313,8 +313,7 @@ void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure) ...@@ -313,8 +313,7 @@ void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure)
skip: skip:
iput(inode); iput(inode);
} }
congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT); f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
cond_resched();
if (gc_failure) { if (gc_failure) {
if (++looped >= count) if (++looped >= count)
return; return;
...@@ -803,8 +802,7 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi) ...@@ -803,8 +802,7 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi)
do { do {
ret = __submit_flush_wait(sbi, FDEV(i).bdev); ret = __submit_flush_wait(sbi, FDEV(i).bdev);
if (ret) if (ret)
congestion_wait(BLK_RW_ASYNC, f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
DEFAULT_IO_TIMEOUT);
} while (ret && --count); } while (ret && --count);
if (ret) { if (ret) {
...@@ -3133,7 +3131,7 @@ static unsigned int __issue_discard_cmd_range(struct f2fs_sb_info *sbi, ...@@ -3133,7 +3131,7 @@ static unsigned int __issue_discard_cmd_range(struct f2fs_sb_info *sbi,
blk_finish_plug(&plug); blk_finish_plug(&plug);
mutex_unlock(&dcc->cmd_lock); mutex_unlock(&dcc->cmd_lock);
trimmed += __wait_all_discard_cmd(sbi, NULL); trimmed += __wait_all_discard_cmd(sbi, NULL);
congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT); f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
goto next; goto next;
} }
skip: skip:
......
...@@ -2135,8 +2135,7 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi) ...@@ -2135,8 +2135,7 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
/* we should flush all the data to keep data consistency */ /* we should flush all the data to keep data consistency */
do { do {
sync_inodes_sb(sbi->sb); sync_inodes_sb(sbi->sb);
cond_resched(); f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT);
} while (get_pages(sbi, F2FS_DIRTY_DATA) && retry--); } while (get_pages(sbi, F2FS_DIRTY_DATA) && retry--);
if (unlikely(retry < 0)) if (unlikely(retry < 0))
...@@ -2504,8 +2503,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type, ...@@ -2504,8 +2503,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
&page, &fsdata); &page, &fsdata);
if (unlikely(err)) { if (unlikely(err)) {
if (err == -ENOMEM) { if (err == -ENOMEM) {
congestion_wait(BLK_RW_ASYNC, f2fs_io_schedule_timeout(DEFAULT_IO_TIMEOUT);
DEFAULT_IO_TIMEOUT);
goto retry; goto retry;
} }
set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR); set_sbi_flag(F2FS_SB(sb), SBI_QUOTA_NEED_REPAIR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment