OSDN Git Service

f2fs: optimize code of f2fs_update_extent_tree_range
authorFan Li <fanofcode.li@samsung.com>
Thu, 17 Sep 2015 10:42:06 +0000 (18:42 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:52 +0000 (16:20 -0700)
commit4d1fa815f26ce92dc4710d28f50071174a2340b7
treebd6ffc12c81111fba4c3226ee132536ead25395b
parent41a099de3a8d2b570147445c5cddc59c0daf5e96
f2fs: optimize code of f2fs_update_extent_tree_range

Fix 2 potential problems:
1. when largest extent needs to be invalidated, it will be reset in
   __drop_largest_extent, which makes __is_extent_same after always
   return false, and largest extent unchanged. Now we update it properly.

2. when extent is split and the latter part remains in tree, next_en
   should be the latter part instead of next extent of original extent.
   It will cause merge failure if there is in-place update, although
   there is not, I think this fix will still makes codes less ambiguous.

This patch also simplifies codes of invalidating extents, and optimizes the
procedues that split extent into two.
There are a few modifications after last patch:
1. prev_en now is updated properly.
2. more codes and branches are simplified.

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