Re: [PATCH v2] f2fs: don't call f2fs_issue_discard_timeout() when discard_cmd_cnt is 0 in f2fs_put_super()

From: Chao Yu
Date: Mon Dec 12 2022 - 08:51:32 EST


On 2022/12/12 21:05, Yangtao Li wrote:
Hi,

static inline bool f2fs_realtime_discard_enable(struct f2fs_sb_info *sbi) {
return (test_opt(sbi, DISCARD) && f2fs_hw_support_discard(sbi)) ||
f2fs_hw_should_discard(sbi);
}

It looks the logic is changed?

For a storage device that does not support discard, and we have not actually
issued any discard command. I don't think it is necessary and f2fs should not
be equipped with trim markers.

The difference here is, if we use f2fs_realtime_discard_enable() in
f2fs_put_super(), we will only write checkpoint w/ CP_TRIMMED flag
when discard option is enable and device supports discard.

But actually, if discard option is disabled, we still needs to give
put_super() a chance to write checkpoint w/ CP_TRIMMED flag.

Thanks,


Thx,
Yangtao