This is a note to let you know that I've just added the patch titled f2fs: avoid to issue redundant discard commands to the 4.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-avoid-to-issue-redundant-discard-commands.patch and it can be found in the queue-4.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 8b107f5b97772c7c0c218302e9a4d15b4edf50b4 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Date: Mon, 27 Feb 2017 11:57:11 -0800 Subject: f2fs: avoid to issue redundant discard commands From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> commit 8b107f5b97772c7c0c218302e9a4d15b4edf50b4 upstream. If segs_per_sec is over 1 like under SMR, previously f2fs issues discard commands redundantly on the same section, since we didn't move end position for the previous discard command. E.g., start end | | prefree_bitmap = [01111100111100] And, after issue discard for this section, end start | | prefree_bitmap = [01111100111100] Select this section again by searching from (end + 1), start end | | prefree_bitmap = [01111100111100] Fixes: 36abef4e796d38 ("f2fs: introduce mode=lfs mount option") Cc: Damien Le Moal <damien.lemoal@xxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/f2fs/segment.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -935,6 +935,8 @@ next: start = start_segno + sbi->segs_per_sec; if (start < end) goto next; + else + end = start - 1; } mutex_unlock(&dirty_i->seglist_lock); Patches currently in stable-queue which might be from jaegeuk@xxxxxxxxxx are queue-4.10/f2fs-add-ovp-valid_blocks-check-for-bg-gc-victim-to-fg_gc.patch queue-4.10/f2fs-avoid-to-issue-redundant-discard-commands.patch queue-4.10/f2fs-fix-zoned-block-device-support.patch queue-4.10/f2fs-fix-multiple-f2fs_add_link-calls-having-same-name.patch queue-4.10/f2fs-fix-a-problem-of-using-memory-after-free.patch