mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
f2fs: optimize get node page readahead part
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> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
52c2db3f95
commit
e0f56cb44b
@ -921,19 +921,17 @@ struct page *get_node_page_ra(struct page *parent, int start)
|
|||||||
if (!nid)
|
if (!nid)
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
|
|
||||||
page = find_get_page(mapping, nid);
|
|
||||||
if (page && PageUptodate(page))
|
|
||||||
goto page_hit;
|
|
||||||
f2fs_put_page(page, 0);
|
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
page = grab_cache_page(mapping, nid);
|
page = grab_cache_page(mapping, nid);
|
||||||
if (!page)
|
if (!page)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
else if (PageUptodate(page))
|
||||||
|
goto page_hit;
|
||||||
|
|
||||||
err = read_node_page(page, READ_SYNC);
|
err = read_node_page(page, READ_SYNC);
|
||||||
|
unlock_page(page);
|
||||||
if (err) {
|
if (err) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 0);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -947,8 +945,9 @@ repeat:
|
|||||||
ra_node_page(sbi, nid);
|
ra_node_page(sbi, nid);
|
||||||
}
|
}
|
||||||
|
|
||||||
page_hit:
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
|
|
||||||
|
page_hit:
|
||||||
if (PageError(page)) {
|
if (PageError(page)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
|
Loading…
Reference in New Issue
Block a user