]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
f2fs: avoid to issue redundant discard commands
authorJaegeuk Kim <jaegeuk@kernel.org>
Mon, 27 Feb 2017 19:57:11 +0000 (11:57 -0800)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 13 Mar 2017 21:20:54 +0000 (15:20 -0600)
commitc4edb61a800d52bb476065b1ea5f37f50e65a5c0
treef1c7a05de1df327ab0ca5e07fc9b51829a2e833c
parent47969bd9d2dbf0867acdca66a711c4158073d025
f2fs: avoid to issue redundant discard commands

BugLink: http://bugs.launchpad.net/bugs/1672544
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@wdc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/f2fs/segment.c