f2fs: fix normal discard process
authorDongdong Zhang <zhangdongdong1@oppo.com>
Tue, 25 Oct 2022 09:40:36 +0000 (17:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:31 +0000 (13:32 +0100)
commitfa2e65c1b1c6d0369e20b295d68cada1d25bc5a1
tree46dec03591647e91b254293b12d2a9a7e80f050c
parent7e7db55d1e67f0fa0e7347769cc1a53e85d9d4c2
f2fs: fix normal discard process

[ Upstream commit b5f1a218ae5e4339130d6e733f0e63d623e09a2c ]

In the DPOLICY_BG mode, there is a conflict between
the two conditions "i + 1 < dpolicy->granularity" and
"i < DEFAULT_DISCARD_GRANULARITY". If i = 15, the first
condition is false, it will enter the second condition
and dispatch all small granularity discards in function
 __issue_discard_cmd_orderly. The restrictive effect
of the first condition to small discards will be
invalidated. These two conditions should align.

Fixes: 20ee4382322c ("f2fs: issue small discard by LBA order")
Signed-off-by: Dongdong Zhang <zhangdongdong1@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/segment.c