linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH -next] f2fs: total hit count should only be increased when entry found
@ 2022-09-05 14:12 Zhang Qilong via Linux-f2fs-devel
  2022-09-06  3:10 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Qilong via Linux-f2fs-devel @ 2022-09-05 14:12 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel

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 <zhangqilong3@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH -next] f2fs: total hit count should only be increased when entry found
  2022-09-05 14:12 [f2fs-dev] [PATCH -next] f2fs: total hit count should only be increased when entry found Zhang Qilong via Linux-f2fs-devel
@ 2022-09-06  3:10 ` Chao Yu
  2022-09-06  7:14   ` [f2fs-dev] 答复: " zhangqilong via Linux-f2fs-devel
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2022-09-06  3:10 UTC (permalink / raw)
  To: Zhang Qilong, jaegeuk; +Cc: linux-f2fs-devel

On 2022/9/5 22:12, Zhang Qilong wrote:
> 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.

Actually, f2fs will account total lookup count into sbi->total_hit_ext.

Thanks,

> 
> Fixes:54c2258cd63a8 ("f2fs: extract rb-tree operation infrastructure")
> Signed-off-by: Zhang Qilong <zhangqilong3@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);


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [f2fs-dev] 答复: [PATCH -next] f2fs: total hit count should only be increased when entry found
  2022-09-06  3:10 ` Chao Yu
@ 2022-09-06  7:14   ` zhangqilong via Linux-f2fs-devel
  0 siblings, 0 replies; 3+ messages in thread
From: zhangqilong via Linux-f2fs-devel @ 2022-09-06  7:14 UTC (permalink / raw)
  To: Chao Yu, jaegeuk; +Cc: linux-f2fs-devel

> when entry found
> 
> On 2022/9/5 22:12, Zhang Qilong wrote:
> > 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.
> 
> Actually, f2fs will account total lookup count into sbi->total_hit_ext.
> 
> Thanks,
OK, I get it. The name confused me :). Maybe we could consider changing the names of member variable and function?
Like total_access_count or total_lookup_count, etc, just a little suggestion for reference only.

Thanks,
> 
> >
> > Fixes:54c2258cd63a8 ("f2fs: extract rb-tree operation infrastructure")
> > Signed-off-by: Zhang Qilong <zhangqilong3@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);

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-06  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 14:12 [f2fs-dev] [PATCH -next] f2fs: total hit count should only be increased when entry found Zhang Qilong via Linux-f2fs-devel
2022-09-06  3:10 ` Chao Yu
2022-09-06  7:14   ` [f2fs-dev] 答复: " zhangqilong via Linux-f2fs-devel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).