f2fs: use extent cache for dir
We update extent cache for all user inode of f2fs including dir inode, so this patch gives another chance to try to get physical address of page from extent cache for dir inode. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
91c5d9bce7
commit
cb3bc9ee06
|
@ -806,6 +806,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
|
||||||
struct address_space *mapping = inode->i_mapping;
|
struct address_space *mapping = inode->i_mapping;
|
||||||
struct dnode_of_data dn;
|
struct dnode_of_data dn;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
struct extent_info ei;
|
||||||
int err;
|
int err;
|
||||||
struct f2fs_io_info fio = {
|
struct f2fs_io_info fio = {
|
||||||
.type = DATA,
|
.type = DATA,
|
||||||
|
@ -817,6 +818,11 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
|
||||||
return page;
|
return page;
|
||||||
f2fs_put_page(page, 0);
|
f2fs_put_page(page, 0);
|
||||||
|
|
||||||
|
if (f2fs_lookup_extent_cache(inode, index, &ei)) {
|
||||||
|
dn.data_blkaddr = ei.blk + index - ei.fofs;
|
||||||
|
goto got_it;
|
||||||
|
}
|
||||||
|
|
||||||
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
||||||
err = get_dnode_of_data(&dn, index, LOOKUP_NODE);
|
err = get_dnode_of_data(&dn, index, LOOKUP_NODE);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -830,6 +836,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
|
||||||
if (unlikely(dn.data_blkaddr == NEW_ADDR))
|
if (unlikely(dn.data_blkaddr == NEW_ADDR))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
|
got_it:
|
||||||
page = grab_cache_page(mapping, index);
|
page = grab_cache_page(mapping, index);
|
||||||
if (!page)
|
if (!page)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
@ -864,6 +871,7 @@ struct page *get_lock_data_page(struct inode *inode, pgoff_t index)
|
||||||
struct address_space *mapping = inode->i_mapping;
|
struct address_space *mapping = inode->i_mapping;
|
||||||
struct dnode_of_data dn;
|
struct dnode_of_data dn;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
struct extent_info ei;
|
||||||
int err;
|
int err;
|
||||||
struct f2fs_io_info fio = {
|
struct f2fs_io_info fio = {
|
||||||
.type = DATA,
|
.type = DATA,
|
||||||
|
@ -874,6 +882,11 @@ repeat:
|
||||||
if (!page)
|
if (!page)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
if (f2fs_lookup_extent_cache(inode, index, &ei)) {
|
||||||
|
dn.data_blkaddr = ei.blk + index - ei.fofs;
|
||||||
|
goto got_it;
|
||||||
|
}
|
||||||
|
|
||||||
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
set_new_dnode(&dn, inode, NULL, NULL, 0);
|
||||||
err = get_dnode_of_data(&dn, index, LOOKUP_NODE);
|
err = get_dnode_of_data(&dn, index, LOOKUP_NODE);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -887,6 +900,7 @@ repeat:
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
got_it:
|
||||||
if (PageUptodate(page))
|
if (PageUptodate(page))
|
||||||
return page;
|
return page;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue