Skip to contentSkip to conversation

f2fs: optimize get node page readahead part

PATCH In review Namjae Jeon 2 participants 3 messages Feb 2, 2013 – Feb 4, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 f2fs: optimize get node page readahead part

From: Namjae Jeon <[email protected]>

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.

---
 fs/f2fs/node.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
fs/f2fs/node.c +4 -6
index 33fa6d5..723185b 100644
@@ -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);
Signature · 1 line
1.7.9.5
#1 lore raw

Hi,

2013-02-02 (토), 23:51 +0900, Namjae Jeon:

Quoted 19 lines

From: Namjae Jeon <[email protected]>

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.

---
 fs/f2fs/node.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
fs/f2fs/node.c +0 -0
index 33fa6d5..723185b 100644

fs/f2fs/node.c struct page *get_node_page_ra(struct page *parent, int start) · line 927

Quoted 8 lines
fs/f2fs/node.c +0 -5
@@ -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,

Signature · 2 lines
Jaegeuk Kim
Samsung
#2 lore raw

2013/2/4, Jaegeuk Kim <[email protected]>:

Quoted 26 lines

Hi,

2013-02-02 (토), 23:51 +0900, Namjae Jeon:

Quoted 23 lines

From: Namjae Jeon <[email protected]>

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.

---
 fs/f2fs/node.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
fs/f2fs/node.c +0 -0
index 33fa6d5..723185b 100644
@@ -920,15 +920,12 @@ struct page *get_node_page_ra(struct page *parent,
 int start)
 	if (!nid)
 		return ERR_PTR(-ENOENT);
 
Quoted 10 lines

fs/f2fs/node.c struct page *get_node_page_ra(struct page *parent, int start) · line 927

Quoted 5 lines
fs/f2fs/node.c +0 -5
-	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!

Quoted 5 lines

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html