We should not increase total hit count when not
found the entry in cache extent tree. Remove the
stat_inc_total_hit when f2fs_lookup_rb_tree returns
nullptr.

Fixes:54c2258cd63a8 ("f2fs: extract rb-tree operation infrastructure")
Signed-off-by: Zhang Qilong <zhangqilo...@huawei.com>
---
 fs/f2fs/extent_cache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
index 866e72b29bd5..264682eebcd1 100644
--- a/fs/f2fs/extent_cache.c
+++ b/fs/f2fs/extent_cache.c
@@ -426,6 +426,7 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, 
pgoff_t pgofs,
                *ei = et->largest;
                ret = true;
                stat_inc_largest_node_hit(sbi);
+               stat_inc_total_hit(sbi);
                goto out;
        }
 
@@ -447,8 +448,8 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, 
pgoff_t pgofs,
        }
        spin_unlock(&sbi->extent_lock);
        ret = true;
-out:
        stat_inc_total_hit(sbi);
+out:
        read_unlock(&et->lock);
 
        trace_f2fs_lookup_extent_tree_end(inode, pgofs, ei);
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to