summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-06-22 18:22:38 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2015-08-04 14:09:54 -0700
commit244f4fc1c530c4e486f0e4f0909c0514e4539ba2 (patch)
tree49b1cd24dc8ebc1743fd4f94ba4df571dbe06e18 /fs/f2fs/data.c
parentcbe91923a97c96d6a931f4b5b7e32083218a0251 (diff)
downloadlinux-244f4fc1c530c4e486f0e4f0909c0514e4539ba2.tar.gz
linux-244f4fc1c530c4e486f0e4f0909c0514e4539ba2.tar.bz2
linux-244f4fc1c530c4e486f0e4f0909c0514e4539ba2.zip
f2fs: set cached_en after checking finally
This patch relocates cached_en not only to be covered by spin_lock, but also to set once after checking out completely. Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 176e4ad4e5ed..982a1a58efd7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -453,14 +453,12 @@ static struct extent_node *__lookup_extent_tree(struct extent_tree *et,
while (node) {
en = rb_entry(node, struct extent_node, rb_node);
- if (fofs < en->ei.fofs) {
+ if (fofs < en->ei.fofs)
node = node->rb_left;
- } else if (fofs >= en->ei.fofs + en->ei.len) {
+ else if (fofs >= en->ei.fofs + en->ei.len)
node = node->rb_right;
- } else {
- et->cached_en = en;
+ else
return en;
- }
}
return NULL;
}
@@ -625,6 +623,7 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs,
spin_lock(&sbi->extent_lock);
if (!list_empty(&en->list))
list_move_tail(&en->list, &sbi->extent_list);
+ et->cached_en = en;
spin_unlock(&sbi->extent_lock);
stat_inc_read_hit(sbi->sb);
}