linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <yuchao0@huawei.com>
To: Yunlei He <heyunlei@huawei.com>,
	jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: seperate read nat page from nat_tree_lock
Date: Mon, 24 Apr 2017 14:55:37 +0800	[thread overview]
Message-ID: <a8c3b869-fc3e-ced2-a85e-8b3fd2ad6d86@huawei.com> (raw)
In-Reply-To: <20170422100626.21995-1-heyunlei@huawei.com>

On 2017/4/22 18:06, Yunlei He wrote:
> This patch seperate nat page read io from nat_tree_lock.
> 
> -lock_page
> 	-get_node_info()
> 		-current_nat_addr
> 
> 			......           	->       write_checkpoint
> 
> 			-get_meta_page
> 
> Because we lock node page, we can make sure no other threads
> modify this nid concurrently. So we just obtain current_nat_addr
> under nat_tree_lock, node info is always same in both nat pack.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> ---
>  fs/f2fs/node.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index ad54e90..b99e318 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -376,6 +376,7 @@ void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni)
>  	struct page *page = NULL;
>  	struct f2fs_nat_entry ne;
>  	struct nat_entry *e;
> +	pgoff_t index;
>  	int i;
>  
>  	ni->nid = nid;
> @@ -401,17 +402,21 @@ void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni)
>  		node_info_from_raw_nat(ni, &ne);
>  	}
>  	up_read(&curseg->journal_rwsem);
> -	if (i >= 0)
> +	if (i >= 0) {
> +		up_read(&nm_i->nat_tree_lock);
>  		goto cache;
> +	}
>  
>  	/* Fill node_info from nat page */
> -	page = get_current_nat_page(sbi, start_nid);
> +	index = current_nat_addr(sbi, nid);
> +	up_read(&nm_i->nat_tree_lock);
> +
> +	page = get_meta_page(sbi, index);
>  	nat_blk = (struct f2fs_nat_block *)page_address(page);
>  	ne = nat_blk->entries[nid - start_nid];
>  	node_info_from_raw_nat(ni, &ne);
>  	f2fs_put_page(page, 1);
>  cache:
> -	up_read(&nm_i->nat_tree_lock);
>  	/* cache nat entry */
>  	down_write(&nm_i->nat_tree_lock);
>  	cache_nat_entry(sbi, nid, &ne);
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

      reply	other threads:[~2017-04-24  6:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-22 10:06 [PATCH] f2fs: seperate read nat page from nat_tree_lock Yunlei He
2017-04-24  6:55 ` Chao Yu [this message]

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=a8c3b869-fc3e-ced2-a85e-8b3fd2ad6d86@huawei.com \
    --to=yuchao0@huawei.com \
    --cc=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).