lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1386545831.2101.67.camel@kjgkr>
Date:	Mon, 09 Dec 2013 08:37:11 +0900
From:	Jaegeuk Kim <jaegeuk.kim@...sung.com>
To:	Chao Yu <chao2.yu@...sung.com>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 3/3 V2] f2fs: introduce f2fs_cache_node_page()
 to add page into node_inode cache

2013-12-06 (금), 17:10 +0800, Chao Yu:
> This patch introduces f2fs_cache_node_page(), in this function, page which is
> readed ahead will be copy to node_inode's mapping cache.
> It will avoid rereading these node pages.
> 
> change log:
>  o check validity of grabbed page suggested by Jaegeuk Kim.
> 
> Suggested-by: Jaegeuk Kim <jaegeuk.kim@...sung.com>
> Signed-off-by: Chao Yu <chao2.yu@...sung.com>
> ---
>  fs/f2fs/node.c |   35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 099f06f..3ff98fa 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1600,6 +1600,39 @@ static int ra_sum_pages(struct f2fs_sb_info *sbi, struct list_head *pages,
>  	return 0;
>  }
>  
> +/*
> + * f2fs_cache_node_page() copy updated page data to node_inode cache page.
> + */
> +void f2fs_cache_node_page(struct f2fs_sb_info *sbi, struct page *page,
> +						nid_t nid)
> +{
> +	struct address_space *mapping = sbi->node_inode->i_mapping;
> +	struct page *npage;


What I meant for the validity was to check the block address to figure
out this node page is up-to-date or not.
IOW, something like this.

  get_node_info(sbi, nid, &ni);
 
  if (ni.blk_addr != current block address))
    goto out;

  npage = grab_cache_page(mapping, nid);
  if (unlikely(!npage))
    return;

  if (unlikely(PageUptodate(npage))) {
    f2fs_put_page(npage, 1);
    return;
  }
  memcpy(page_address(npage), page_address(page), PAGE_CACHE_SIZE);

  SetPageUptodate(npage);
  f2fs_put_page(npage, 1);
out:
  return;
 
> +
> +	npage = find_get_page(mapping, nid);
> +	if (unlikely(npage && PageUptodate(npage))) {
> +		f2fs_put_page(npage, 0);
> +		return;
> +	}
> +	f2fs_put_page(npage, 0);
> +
> +	npage = grab_cache_page(mapping, nid);
> +	if (unlikely(!npage))
> +		return;
> +
> +	if (unlikely(PageUptodate(npage))) {
> +		f2fs_put_page(npage, 1);
> +		return;
> +	}
> +
> +	memcpy(page_address(npage), page_address(page), PAGE_CACHE_SIZE);
> +
> +	SetPageUptodate(npage);
> +	f2fs_put_page(npage, 1);
> +
> +	return;
> +}
> +
>  int restore_node_summary(struct f2fs_sb_info *sbi,
>  			unsigned int segno, struct f2fs_summary_block *sum)
>  {
> @@ -1633,6 +1666,8 @@ int restore_node_summary(struct f2fs_sb_info *sbi,
>  				sum_entry->version = 0;
>  				sum_entry->ofs_in_node = 0;
>  				sum_entry++;
> +				f2fs_cache_node_page(sbi, page,
> +					le32_to_cpu(rn->footer.nid));
>  			} else {
>  				err = -EIO;
>  			}

-- 
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ