summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/extent_cache.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2015-08-19 19:12:20 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-08-21 22:45:15 -0700
commit91c481fff92c705dd382f1f53c01e6b6b88507d0 (patch)
tree5a4192bcf89ce525bd9992cf879c16f886acf035 /fs/f2fs/extent_cache.c
parente2b4e2bc8865e03eecd49caa9713a2402a96bba9 (diff)
downloadlinux-91c481fff92c705dd382f1f53c01e6b6b88507d0.tar.gz
linux-91c481fff92c705dd382f1f53c01e6b6b88507d0.tar.bz2
linux-91c481fff92c705dd382f1f53c01e6b6b88507d0.zip
f2fs: add largest/cached stat in extent cache
This patch adds to stat the hit count of largest/cached node for showing in debugfs. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/extent_cache.c')
-rw-r--r--fs/f2fs/extent_cache.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
index cea581353bc2..5cf217faed1f 100644
--- a/fs/f2fs/extent_cache.c
+++ b/fs/f2fs/extent_cache.c
@@ -81,8 +81,8 @@ static struct extent_tree *__grab_extent_tree(struct inode *inode)
return et;
}
-static struct extent_node *__lookup_extent_tree(struct extent_tree *et,
- unsigned int fofs)
+static struct extent_node *__lookup_extent_tree(struct f2fs_sb_info *sbi,
+ struct extent_tree *et, unsigned int fofs)
{
struct rb_node *node = et->root.rb_node;
struct extent_node *en = et->cached_en;
@@ -90,8 +90,10 @@ static struct extent_node *__lookup_extent_tree(struct extent_tree *et,
if (en) {
struct extent_info *cei = &en->ei;
- if (cei->fofs <= fofs && cei->fofs + cei->len > fofs)
+ if (cei->fofs <= fofs && cei->fofs + cei->len > fofs) {
+ stat_inc_cached_node_hit(sbi);
return en;
+ }
}
while (node) {
@@ -280,10 +282,11 @@ static bool f2fs_lookup_extent_tree(struct inode *inode, pgoff_t pgofs,
*ei = et->largest;
ret = true;
stat_inc_read_hit(sbi);
+ stat_inc_largest_node_hit(sbi);
goto out;
}
- en = __lookup_extent_tree(et, pgofs);
+ en = __lookup_extent_tree(sbi, et, pgofs);
if (en) {
*ei = en->ei;
spin_lock(&sbi->extent_lock);
@@ -313,7 +316,8 @@ out:
* tree must stay unchanged between lookup and insertion.
*/
static struct extent_node *__lookup_extent_tree_ret(struct extent_tree *et,
- unsigned int fofs, struct extent_node **prev_ex,
+ unsigned int fofs,
+ struct extent_node **prev_ex,
struct extent_node **next_ex,
struct rb_node ***insert_p,
struct rb_node **insert_parent)