f2fs: fix normal discard process

Message ID 1666680982-372975-1-git-send-email-zhangdongdong1@oppo.com
State New
Headers
Series f2fs: fix normal discard process |

Commit Message

zhangdongdong Oct. 25, 2022, 6:56 a.m. UTC
  in the DPOLICY_BG mode,
i + 1 < dpolicy->granularity and i < DEFAULT_DISCARD_GRANULARITY conflict.
if i = 15,The first condition is not met, it will directly enter the
second condition and dispatch all small granularity discards.
The restrictive effect of the first condition will be invalidated.

Fixes: <20ee438232> ("f2fs: issue small discard by LBA order")
Signed-off-by: zhangdongdong <zhangdongdong1@oppo.com>
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.7.4
  

Patch

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];