From nobody Wed Oct 15 22:39:50 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D79121C96D; Sun, 24 Mar 2024 23:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323551; cv=none; b=BQjseZfTHg0Ea1obiOsdv/UOaq1CND8JlMD3Np/OjXPLfSKv8zj9sarzyFrXePadmOE4aIUd+eHGocMEpuH9A9Xaf+CyVZ1RPbbc6raLGfP7OG5IstgUyBj9d8JF5ucdG8wZz85IYS5BZ9x8CEaT8xhtvv/cBNCMrlPeG+lr/z4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323551; c=relaxed/simple; bh=Cx4KeOsxACoPJa7tvaqkAJSRCvtw+xZI4off/mQPwMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uAMyG840QGsM6Wt/Gw7S8LBwL+zEFooISrFyygpBxXhaPX6kjRKgcKINHTSHjUmDQRmoeZSqlwltUZD7i8nUiiSdMb0BuyqCDfqtNo8ECmvhGZWuPrBnpNzwVjUwQTRkYsve5Y57CFQfxuxpyOKEfdzKz4uT1/VWkWMe3fWR71o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IEz/onxW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IEz/onxW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F7F6C43394; Sun, 24 Mar 2024 23:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323550; bh=Cx4KeOsxACoPJa7tvaqkAJSRCvtw+xZI4off/mQPwMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IEz/onxWr1EvSXIWJ44v+Ux3L4npa68W4RVSj2nkpmbizSps23j971ygjy5b06X0K DFCX+gnDic5YJ8btuHFhwyk03hprpNk0LQos60P3ZT/V74KdgDooYtLePvK/3bDD6z oSPUCw/YalHpjMYevwHO+fRU/i/qMSOUbmwH2R1eT/cHIwCr5AUhe2Mzwxl8DJHp+V rNESWCTOLrZUS58bscttw2iSBtVt/3ZvOma0SWSMjN4p2kBIVIroPHakKbZka+0320 c0T8EBNaIFKqVNEef2EHg7GU6nP24mMfcyTFqjF8oicrxnbJQIs4zM+dAjvhw685LP eSHj0iA6QA6GA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: NeilBrown , Anna Schumaker , Chao Yu , "Darrick J . Wong" , Ilya Dryomov , Jaegeuk Kim , Jan Kara , Jeff Layton , Jens Axboe , Lars Ellenberg , Miklos Szeredi , Paolo Valente , Philipp Reisner , Ryusuke Konishi , Trond Myklebust , Wu Fengguang , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.15 257/317] f2fs: replace congestion_wait() calls with io_schedule_timeout() Date: Sun, 24 Mar 2024 19:33:57 -0400 Message-ID: <20240324233458.1352854-258-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324233458.1352854-1-sashal@kernel.org> References: <20240324233458.1352854-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown [ 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 Cc: Anna Schumaker Cc: Chao Yu Cc: Darrick J. Wong Cc: Ilya Dryomov Cc: Jaegeuk Kim Cc: Jan Kara Cc: Jeff Layton Cc: Jens Axboe Cc: Lars Ellenberg Cc: Miklos Szeredi Cc: Paolo Valente Cc: Philipp Reisner Cc: Ryusuke Konishi Cc: Trond Myklebust Cc: Wu Fengguang Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Stable-dep-of: fd244524c2cf ("f2fs: compress: fix to cover normal cluster w= rite with cp_rwsem") Signed-off-by: Sasha Levin --- 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 =3D 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_spac= e *mapping, } else if (ret =3D=3D -EAGAIN) { ret =3D 0; if (wbc->sync_mode =3D=3D 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 f2= fs_sb_info *sbi) return F2FS_OPTION(sbi).discard_unit =3D=3D DISCARD_UNIT_BLOCK; } =20 +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 */ =20 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 >=3D count) return; @@ -789,8 +788,7 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi) do { ret =3D __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); =20 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 +=3D __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_inf= o *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--); =20 if (unlikely(retry < 0)) @@ -2540,8 +2539,7 @@ static ssize_t f2fs_quota_write(struct super_block *s= b, int type, &page, &fsdata); if (unlikely(err)) { if (err =3D=3D -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); --=20 2.43.0