Commit 42926744 authored by Jaegeuk Kim's avatar Jaegeuk Kim

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: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 43a2fa18
...@@ -243,9 +243,10 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs, ...@@ -243,9 +243,10 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs,
if (en) { if (en) {
*ei = en->ei; *ei = en->ei;
spin_lock(&sbi->extent_lock); spin_lock(&sbi->extent_lock);
if (!list_empty(&en->list)) if (!list_empty(&en->list)) {
list_move_tail(&en->list, &sbi->extent_list); list_move_tail(&en->list, &sbi->extent_list);
et->cached_en = en; et->cached_en = en;
}
spin_unlock(&sbi->extent_lock); spin_unlock(&sbi->extent_lock);
ret = true; ret = true;
} }
...@@ -364,11 +365,12 @@ static struct extent_node *__try_merge_extent_node(struct f2fs_sb_info *sbi, ...@@ -364,11 +365,12 @@ static struct extent_node *__try_merge_extent_node(struct f2fs_sb_info *sbi,
return NULL; return NULL;
__try_update_largest_extent(et, en); __try_update_largest_extent(et, en);
et->cached_en = en;
spin_lock(&sbi->extent_lock); spin_lock(&sbi->extent_lock);
if (!list_empty(&en->list)) if (!list_empty(&en->list)) {
list_move_tail(&en->list, &sbi->extent_list); list_move_tail(&en->list, &sbi->extent_list);
et->cached_en = en;
}
spin_unlock(&sbi->extent_lock); spin_unlock(&sbi->extent_lock);
return en; return en;
} }
...@@ -405,11 +407,11 @@ static struct extent_node *__insert_extent_tree(struct f2fs_sb_info *sbi, ...@@ -405,11 +407,11 @@ static struct extent_node *__insert_extent_tree(struct f2fs_sb_info *sbi,
return NULL; return NULL;
__try_update_largest_extent(et, en); __try_update_largest_extent(et, en);
et->cached_en = en;
/* update in global extent list */ /* update in global extent list */
spin_lock(&sbi->extent_lock); spin_lock(&sbi->extent_lock);
list_add_tail(&en->list, &sbi->extent_list); list_add_tail(&en->list, &sbi->extent_list);
et->cached_en = en;
spin_unlock(&sbi->extent_lock); spin_unlock(&sbi->extent_lock);
return en; return en;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment