linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] f2fs: optimize get node page readahead part
@ 2013-02-02 14:51 Namjae Jeon
  2013-02-04  1:38 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Namjae Jeon @ 2013-02-02 14:51 UTC (permalink / raw)
  To: jaegeuk.kim
  Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel, Namjae Jeon,
	Namjae Jeon, Amit Sahrawat

From: Namjae Jeon <namjae.jeon@samsung.com>

We can remove the call to find_get_page to get a page from the cache
and check for up-to-date, instead we can make use of grab_cache_page
part itself to fetch the page from the cache.
So, removing the call and moving the PageUptodate at proper place, also
taken care of moving the lock_page condition in the page_hit part.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
---
 fs/f2fs/node.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 33fa6d5..723185b 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -920,15 +920,12 @@ struct page *get_node_page_ra(struct page *parent, int start)
 	if (!nid)
 		return ERR_PTR(-ENOENT);
 
-	page = find_get_page(mapping, nid);
-	if (page && PageUptodate(page))
-		goto page_hit;
-	f2fs_put_page(page, 0);
-
 repeat:
 	page = grab_cache_page(mapping, nid);
 	if (!page)
 		return ERR_PTR(-ENOMEM);
+	else if (PageUptodate(page))
+		goto page_hit;
 
 	err = read_node_page(page, READA);
 	if (err) {
@@ -946,8 +943,9 @@ repeat:
 		ra_node_page(sbi, nid);
 	}
 
-page_hit:
 	lock_page(page);
+
+page_hit:
 	if (PageError(page)) {
 		f2fs_put_page(page, 1);
 		return ERR_PTR(-EIO);
-- 
1.7.9.5

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

* Re: [PATCH 1/6] f2fs: optimize get node page readahead part
  2013-02-02 14:51 [PATCH 1/6] f2fs: optimize get node page readahead part Namjae Jeon
@ 2013-02-04  1:38 ` Jaegeuk Kim
  2013-02-04  2:06   ` Namjae Jeon
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2013-02-04  1:38 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel, Namjae Jeon,
	Amit Sahrawat

[-- Attachment #1: Type: text/plain, Size: 1295 bytes --]

Hi,

2013-02-02 (토), 23:51 +0900, Namjae Jeon:
> From: Namjae Jeon <namjae.jeon@samsung.com>
> 
> We can remove the call to find_get_page to get a page from the cache
> and check for up-to-date, instead we can make use of grab_cache_page
> part itself to fetch the page from the cache.
> So, removing the call and moving the PageUptodate at proper place, also
> taken care of moving the lock_page condition in the page_hit part.
> 
> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
> Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
> ---
>  fs/f2fs/node.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 33fa6d5..723185b 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -920,15 +920,12 @@ struct page *get_node_page_ra(struct page *parent, int start)
>  	if (!nid)
>  		return ERR_PTR(-ENOENT);
>  
> -	page = find_get_page(mapping, nid);
> -	if (page && PageUptodate(page))
> -		goto page_hit;
> -	f2fs_put_page(page, 0);
> -

The reason why we use this is to avoid the lock overhead.
This is a readahead flow, and we don't need to care about real
existence. Let's get and check the status of the page without any locks.
Thanks,

-- 
Jaegeuk Kim
Samsung

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 1/6] f2fs: optimize get node page readahead part
  2013-02-04  1:38 ` Jaegeuk Kim
@ 2013-02-04  2:06   ` Namjae Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2013-02-04  2:06 UTC (permalink / raw)
  To: jaegeuk.kim
  Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel, Namjae Jeon,
	Amit Sahrawat

2013/2/4, Jaegeuk Kim <jaegeuk.kim@samsung.com>:
> Hi,
>
> 2013-02-02 (토), 23:51 +0900, Namjae Jeon:
>> From: Namjae Jeon <namjae.jeon@samsung.com>
>>
>> We can remove the call to find_get_page to get a page from the cache
>> and check for up-to-date, instead we can make use of grab_cache_page
>> part itself to fetch the page from the cache.
>> So, removing the call and moving the PageUptodate at proper place, also
>> taken care of moving the lock_page condition in the page_hit part.
>>
>> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
>> Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
>> ---
>>  fs/f2fs/node.c |   10 ++++------
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index 33fa6d5..723185b 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -920,15 +920,12 @@ struct page *get_node_page_ra(struct page *parent,
>> int start)
>>  	if (!nid)
>>  		return ERR_PTR(-ENOENT);
>>
>> -	page = find_get_page(mapping, nid);
>> -	if (page && PageUptodate(page))
>> -		goto page_hit;
>> -	f2fs_put_page(page, 0);
>> -
>
> The reason why we use this is to avoid the lock overhead.
> This is a readahead flow, and we don't need to care about real
> existence. Let's get and check the status of the page without any locks.
> Thanks,
Yes, Agreed. I will chceck more about this.
Thanks a lot!
>
> --
> Jaegeuk Kim
> Samsung
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-02-04  2:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-02 14:51 [PATCH 1/6] f2fs: optimize get node page readahead part Namjae Jeon
2013-02-04  1:38 ` Jaegeuk Kim
2013-02-04  2:06   ` Namjae Jeon

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).