mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
f2fs: fix to set .discard_granularity correctly
commit4f993264fe("f2fs: introduce discard_unit mount option") introduced a bug, when we enable discard_unit=section option, it will set .discard_granularity to BLKS_PER_SEC(), however discard granularity only supports [1, 512], once section size is not equal to segment size, it will cause issue_discard_thread() in DPOLICY_BG mode will not select discard entry w/ any granularity to issue. Fixes:4f993264fe("f2fs: introduce discard_unit mount option") Reviewed-by: Daeho Jeong <daehojeong@google.com> Signed-off-by: Yohan Joung <yohan.joung@sk.com> Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
a907f3a68e
commit
1b60b23975
|
|
@ -2320,10 +2320,9 @@ static int create_discard_cmd_control(struct f2fs_sb_info *sbi)
|
|||
dcc->discard_granularity = DEFAULT_DISCARD_GRANULARITY;
|
||||
dcc->max_ordered_discard = DEFAULT_MAX_ORDERED_DISCARD_GRANULARITY;
|
||||
dcc->discard_io_aware = DPOLICY_IO_AWARE_ENABLE;
|
||||
if (F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_SEGMENT)
|
||||
if (F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_SEGMENT ||
|
||||
F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_SECTION)
|
||||
dcc->discard_granularity = BLKS_PER_SEG(sbi);
|
||||
else if (F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_SECTION)
|
||||
dcc->discard_granularity = BLKS_PER_SEC(sbi);
|
||||
|
||||
INIT_LIST_HEAD(&dcc->entry_list);
|
||||
for (i = 0; i < MAX_PLIST_NUM; i++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user