mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
ntfs3: Convert ni_readpage_cmpr() to take a folio
We still use an array of pages for the decompression, but this removes a few calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
584f60ba22
commit
4d89b6716b
@ -2087,12 +2087,12 @@ out:
|
||||
* When decompressing, we typically obtain more than one page per reference.
|
||||
* We inject the additional pages into the page cache.
|
||||
*/
|
||||
int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)
|
||||
int ni_readpage_cmpr(struct ntfs_inode *ni, struct folio *folio)
|
||||
{
|
||||
int err;
|
||||
struct ntfs_sb_info *sbi = ni->mi.sbi;
|
||||
struct address_space *mapping = page->mapping;
|
||||
pgoff_t index = page->index;
|
||||
struct address_space *mapping = folio->mapping;
|
||||
pgoff_t index = folio->index;
|
||||
u64 frame_vbo, vbo = (u64)index << PAGE_SHIFT;
|
||||
struct page **pages = NULL; /* Array of at most 16 pages. stack? */
|
||||
u8 frame_bits;
|
||||
@ -2102,7 +2102,8 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)
|
||||
struct page *pg;
|
||||
|
||||
if (vbo >= i_size_read(&ni->vfs_inode)) {
|
||||
SetPageUptodate(page);
|
||||
folio_zero_range(folio, 0, folio_size(folio));
|
||||
folio_mark_uptodate(folio);
|
||||
err = 0;
|
||||
goto out;
|
||||
}
|
||||
@ -2126,7 +2127,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)
|
||||
goto out;
|
||||
}
|
||||
|
||||
pages[idx] = page;
|
||||
pages[idx] = &folio->page;
|
||||
index = frame_vbo >> PAGE_SHIFT;
|
||||
gfp_mask = mapping_gfp_mask(mapping);
|
||||
|
||||
@ -2156,7 +2157,7 @@ out1:
|
||||
out:
|
||||
/* At this point, err contains 0 or -EIO depending on the "critical" page. */
|
||||
kfree(pages);
|
||||
unlock_page(page);
|
||||
folio_unlock(folio);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ static int ntfs_read_folio(struct file *file, struct folio *folio)
|
||||
|
||||
if (is_compressed(ni)) {
|
||||
ni_lock(ni);
|
||||
err = ni_readpage_cmpr(ni, &folio->page);
|
||||
err = ni_readpage_cmpr(ni, folio);
|
||||
ni_unlock(ni);
|
||||
return err;
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ int ni_write_inode(struct inode *inode, int sync, const char *hint);
|
||||
#define _ni_write_inode(i, w) ni_write_inode(i, w, __func__)
|
||||
int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo,
|
||||
__u64 vbo, __u64 len);
|
||||
int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page);
|
||||
int ni_readpage_cmpr(struct ntfs_inode *ni, struct folio *folio);
|
||||
int ni_decompress_file(struct ntfs_inode *ni);
|
||||
int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
|
||||
u32 pages_per_frame);
|
||||
|
Loading…
Reference in New Issue
Block a user