]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: avoid unnecessary search while finding victim in gc
authorFan Li <fanofcode.li@samsung.com>
Wed, 3 Feb 2016 08:21:57 +0000 (16:21 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 23 Feb 2016 00:07:23 +0000 (16:07 -0800)
commitf48dc0eca7960e4880b3a714cb6ef5a4d133a28b
tree15268fe94343e7178133592ca5bbee49b3f3e14a
parentdec44e84095a8872fef93b420ff941eb2266a74a
f2fs: avoid unnecessary search while finding victim in gc

variable nsearched in get_victim_by_default() indicates the number of
dirty segments we already checked. There are 2 problems about the way
it updates:
1. When p.ofs_unit is greater than 1, the victim we find consists
   of multiple segments, possibly more than 1 dirty segment.
   But nsearched always increases by 1.
2. If segments have been found but not been chosen, nsearched won't
   increase. So even we have checked all dirty segments, nsearched
   may still less than p.max_search.
All these problems could cause unnecessary search after all dirty
segments have already been checked.

Signed-off-by: Fan li <fanofcode.li@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c