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>
This commit is contained in:
parent
cbe91923a9
commit
244f4fc1c5
|
@ -453,15 +453,13 @@ static struct extent_node *__lookup_extent_tree(struct extent_tree *et,
|
||||||
while (node) {
|
while (node) {
|
||||||
en = rb_entry(node, struct extent_node, rb_node);
|
en = rb_entry(node, struct extent_node, rb_node);
|
||||||
|
|
||||||
if (fofs < en->ei.fofs) {
|
if (fofs < en->ei.fofs)
|
||||||
node = node->rb_left;
|
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;
|
node = node->rb_right;
|
||||||
} else {
|
else
|
||||||
et->cached_en = en;
|
|
||||||
return en;
|
return en;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,6 +623,7 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs,
|
||||||
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);
|
||||||
stat_inc_read_hit(sbi->sb);
|
stat_inc_read_hit(sbi->sb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue