public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: "'He YunLei'" <heyunlei@huawei.com>
Cc: "'Jaegeuk Kim'" <jaegeuk@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: RE: [f2fs-dev] [PATCH 2/2] f2fs: speed up shrinking extent tree entries
Date: Wed, 23 Dec 2015 17:52:56 +0800	[thread overview]
Message-ID: <010e01d13d67$cfc2a1e0$6f47e5a0$@samsung.com> (raw)
In-Reply-To: <56794358.8030801@huawei.com>

> -----Original Message-----
> From: He YunLei [mailto:heyunlei@huawei.com]
> Sent: Tuesday, December 22, 2015 8:35 PM
> To: Chao Yu
> Cc: 'Jaegeuk Kim'; linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: speed up shrinking extent tree entries
> 
> On 2015/12/22 13:20, Chao Yu wrote:
> > Hi Jaegeuk,
> >
> > We should update &total_zombie_tree whenever removing unreferenced
> > extent tree during shrinking:
> > - f2fs_shrink_extent_tree
> > if (!atomic_read(&et->refcount)) {
> > 	...
> > 	atomic_dec(&sbi->total_ext_tree);
> > 	atomic_dec(&sbi->total_zombie_tree);
> > 	...
> > }
> >
> > Other parts look good to me. :)
> >
> > Reviewed-by: Chao Yu <chao2.yu@samsung.com>
> >
> > Thanks,
> >
> >> -----Original Message-----
> >> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> >> Sent: Tuesday, December 22, 2015 11:39 AM
> >> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> >> linux-f2fs-devel@lists.sourceforge.net
> >> Cc: Jaegeuk Kim
> >> Subject: [f2fs-dev] [PATCH 2/2] f2fs: speed up shrinking extent tree entries
> >>
> >> If there is no candidates for shrinking slab entries, we don't need to traverse
> >> any trees at all.
> >>
> >> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >> ---
> >>   fs/f2fs/extent_cache.c | 12 ++++++++++++
> >>   fs/f2fs/f2fs.h         |  1 +
> >>   fs/f2fs/shrinker.c     |  2 +-
> >>   3 files changed, 14 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
> >> index 0e97d6af..32693af 100644
> >> --- a/fs/f2fs/extent_cache.c
> >> +++ b/fs/f2fs/extent_cache.c
> >> @@ -71,6 +71,8 @@ static struct extent_tree *__grab_extent_tree(struct inode *inode)
> >>   		atomic_set(&et->refcount, 0);
> >>   		et->count = 0;
> >>   		atomic_inc(&sbi->total_ext_tree);
> >> +	} else {
> >> +		atomic_dec(&sbi->total_zombie_tree);
> >>   	}
> >>   	atomic_inc(&et->refcount);
> >>   	up_write(&sbi->extent_tree_lock);
> >> @@ -547,10 +549,14 @@ unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *sbi, int
> >> nr_shrink)
> >>   	unsigned int found;
> >>   	unsigned int node_cnt = 0, tree_cnt = 0;
> >>   	int remained;
> >> +	bool do_free = false;
> >>
> >>   	if (!test_opt(sbi, EXTENT_CACHE))
> >>   		return 0;
> >>
> >> +	if (!atomic_read(&sbi->total_zombie_tree))
> >> +		goto free_node;
> >> +
> >>   	if (!down_write_trylock(&sbi->extent_tree_lock))
> >>   		goto out;
> >>
> >> @@ -580,6 +586,7 @@ unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *sbi, int
> >> nr_shrink)
> >>   	}
> >>   	up_write(&sbi->extent_tree_lock);
> >>
> >> +free_node:
> >>   	/* 2. remove LRU extent entries */
> >>   	if (!down_write_trylock(&sbi->extent_tree_lock))
> >>   		goto out;
> >> @@ -591,9 +598,13 @@ unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *sbi, int
> >> nr_shrink)
> >>   		if (!remained--)
> >>   			break;
> >>   		list_del_init(&en->list);
> >> +		do_free = true;
> >>   	}
> >>   	spin_unlock(&sbi->extent_lock);
> >>
> >> +	if (do_free == false)
> >> +		goto unlock_out;
> >> +
> >>   	/*
> >>   	 * reset ino for searching victims from beginning of global extent tree.
> >>   	 */
> >> @@ -651,6 +662,7 @@ void f2fs_destroy_extent_tree(struct inode *inode)
> >>
> >>   	if (inode->i_nlink && !is_bad_inode(inode) && et->count) {
> >>   		atomic_dec(&et->refcount);
> >> +		atomic_dec(&sbi->total_zombie_tree);
> >>   		return;
> >>   	}
> Hi,all
> 	here, sbi->total_ext_tree-- also should change to
> 	atomic_dec(&sbi->total_ext_tree);

Yunlei,

Seems not right.

Thanks,

> Thanks,
> 
> >>
> >> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> >> index a7f6191..90fb970 100644
> >> --- a/fs/f2fs/f2fs.h
> >> +++ b/fs/f2fs/f2fs.h
> >> @@ -763,6 +763,7 @@ struct f2fs_sb_info {
> >>   	struct list_head extent_list;		/* lru list for shrinker */
> >>   	spinlock_t extent_lock;			/* locking extent lru list */
> >>   	atomic_t total_ext_tree;		/* extent tree count */
> >> +	atomic_t total_zombie_tree;		/* extent zombie tree count */
> >>   	atomic_t total_ext_node;		/* extent info count */
> >>
> >>   	/* basic filesystem units */
> >> diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
> >> index a11e099..93606f2 100644
> >> --- a/fs/f2fs/shrinker.c
> >> +++ b/fs/f2fs/shrinker.c
> >> @@ -32,7 +32,7 @@ static unsigned long __count_free_nids(struct f2fs_sb_info *sbi)
> >>
> >>   static unsigned long __count_extent_cache(struct f2fs_sb_info *sbi)
> >>   {
> >> -	return atomic_read(&sbi->total_ext_tree) +
> >> +	return atomic_read(&sbi->total_zombie_tree) +
> >>   				atomic_read(&sbi->total_ext_node);
> >>   }
> >>
> >> --
> >> 2.5.4 (Apple Git-61)
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> _______________________________________________
> >> Linux-f2fs-devel mailing list
> >> Linux-f2fs-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> >
> >
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> >
> > .
> >



  reply	other threads:[~2015-12-23  9:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  3:38 [PATCH 1/2] f2fs: use atomic variable for total_extent_tree Jaegeuk Kim
2015-12-22  3:38 ` [PATCH 2/2] f2fs: speed up shrinking extent tree entries Jaegeuk Kim
2015-12-22  3:45   ` Jaegeuk Kim
2015-12-22  5:20   ` [f2fs-dev] " Chao Yu
2015-12-22  7:36     ` Jaegeuk Kim
2015-12-22 12:34     ` He YunLei
2015-12-23  9:52       ` Chao Yu [this message]
2015-12-22  5:28 ` [f2fs-dev] [PATCH 1/2] f2fs: use atomic variable for total_extent_tree Chao Yu
2015-12-22  7:34   ` Jaegeuk Kim
2015-12-22  8:08     ` Chao Yu
2015-12-29 11:11 ` He YunLei
2015-12-30  6:44   ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='010e01d13d67$cfc2a1e0$6f47e5a0$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox