mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] f2fs: fix normal discard process
@ 2022-10-25  9:40 zhangdongdong
  2022-10-25  9:54 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: zhangdongdong @ 2022-10-25  9:40 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, Dongdong Zhang

From: Dongdong Zhang <zhangdongdong1@oppo.com>

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>
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index acf3d3f..2fcb140 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1448,7 +1448,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
 		if (i + 1 < dpolicy->granularity)
 			break;
 
-		if (i < DEFAULT_DISCARD_GRANULARITY && dpolicy->ordered)
+		if (i + 1 < DEFAULT_DISCARD_GRANULARITY && dpolicy->ordered)
 			return __issue_discard_cmd_orderly(sbi, dpolicy);
 
 		pend_list = &dcc->pend_list[i];
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] f2fs: fix normal discard process
  2022-10-25  9:40 [PATCH v2] f2fs: fix normal discard process zhangdongdong
@ 2022-10-25  9:54 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2022-10-25  9:54 UTC (permalink / raw)
  To: zhangdongdong, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel

On 2022/10/25 17:40, zhangdongdong wrote:
> From: Dongdong Zhang <zhangdongdong1@oppo.com>
> 
> 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>

Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-25 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25  9:40 [PATCH v2] f2fs: fix normal discard process zhangdongdong
2022-10-25  9:54 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®