Commit a4bf041e authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

nilfs2: convert nilfs_find_entry to use a folio

Use the new folio APIs to remove calls to compound_head().

[konishi.ryusuke: resolved a conflict due to style warning correction]
Link: https://lkml.kernel.org/r/20231127143036.2425-12-konishi.ryusuke@gmail.comSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent b37b2bec
...@@ -339,7 +339,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr, ...@@ -339,7 +339,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
unsigned int reclen = NILFS_DIR_REC_LEN(namelen); unsigned int reclen = NILFS_DIR_REC_LEN(namelen);
unsigned long start, n; unsigned long start, n;
unsigned long npages = dir_pages(dir); unsigned long npages = dir_pages(dir);
struct page *page = NULL; struct folio *folio = NULL;
struct nilfs_inode_info *ei = NILFS_I(dir); struct nilfs_inode_info *ei = NILFS_I(dir);
struct nilfs_dir_entry *de; struct nilfs_dir_entry *de;
...@@ -354,7 +354,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr, ...@@ -354,7 +354,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
start = 0; start = 0;
n = start; n = start;
do { do {
char *kaddr = nilfs_get_page(dir, n, &page); char *kaddr = nilfs_get_folio(dir, n, &folio);
if (!IS_ERR(kaddr)) { if (!IS_ERR(kaddr)) {
de = (struct nilfs_dir_entry *)kaddr; de = (struct nilfs_dir_entry *)kaddr;
...@@ -363,18 +363,18 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr, ...@@ -363,18 +363,18 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
if (de->rec_len == 0) { if (de->rec_len == 0) {
nilfs_error(dir->i_sb, nilfs_error(dir->i_sb,
"zero-length directory entry"); "zero-length directory entry");
unmap_and_put_page(page, kaddr); folio_release_kmap(folio, kaddr);
goto out; goto out;
} }
if (nilfs_match(namelen, name, de)) if (nilfs_match(namelen, name, de))
goto found; goto found;
de = nilfs_next_entry(de); de = nilfs_next_entry(de);
} }
unmap_and_put_page(page, kaddr); folio_release_kmap(folio, kaddr);
} }
if (++n >= npages) if (++n >= npages)
n = 0; n = 0;
/* next page is past the blocks we've got */ /* next folio is past the blocks we've got */
if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) { if (unlikely(n > (dir->i_blocks >> (PAGE_SHIFT - 9)))) {
nilfs_error(dir->i_sb, nilfs_error(dir->i_sb,
"dir %lu size %lld exceeds block count %llu", "dir %lu size %lld exceeds block count %llu",
...@@ -387,7 +387,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr, ...@@ -387,7 +387,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
return NULL; return NULL;
found: found:
*res_page = page; *res_page = &folio->page;
ei->i_dir_start_lookup = n; ei->i_dir_start_lookup = n;
return de; return de;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment