diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-01-26 18:20:05 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-02-23 01:07:23 +0100 |
commit | 429267442af1ddc2f8d9f5195fc5e919b5ced301 (patch) | |
tree | fad789b8fdc185bba42258dae7e18f0328e543b9 /fs/f2fs/extent_cache.c | |
parent | f2fs: move extent_node list operations being coupled with rbtree operation (diff) | |
download | linux-429267442af1ddc2f8d9f5195fc5e919b5ced301.tar.xz linux-429267442af1ddc2f8d9f5195fc5e919b5ced301.zip |
f2fs: don't set cached_en if it will be freed
If en has empty list pointer, it will be freed sooner, so we don't need to
set cached_en with it.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/extent_cache.c')
-rw-r--r-- | fs/f2fs/extent_cache.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c index 995a7b1baa70..aae99f2a4345 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -243,9 +243,10 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs, if (en) { *ei = en->ei; spin_lock(&sbi->extent_lock); - if (!list_empty(&en->list)) + if (!list_empty(&en->list)) { list_move_tail(&en->list, &sbi->extent_list); - et->cached_en = en; + et->cached_en = en; + } spin_unlock(&sbi->extent_lock); ret = true; } @@ -364,11 +365,12 @@ static struct extent_node *__try_merge_extent_node(struct f2fs_sb_info *sbi, return NULL; __try_update_largest_extent(et, en); - et->cached_en = en; spin_lock(&sbi->extent_lock); - if (!list_empty(&en->list)) + if (!list_empty(&en->list)) { list_move_tail(&en->list, &sbi->extent_list); + et->cached_en = en; + } spin_unlock(&sbi->extent_lock); return en; } @@ -405,11 +407,11 @@ do_insert: return NULL; __try_update_largest_extent(et, en); - et->cached_en = en; /* update in global extent list */ spin_lock(&sbi->extent_lock); list_add_tail(&en->list, &sbi->extent_list); + et->cached_en = en; spin_unlock(&sbi->extent_lock); return en; } |