diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2024-04-22 22:32:01 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-06-26 15:48:57 +0300 |
commit | 4d89b6716b00bf52e2c4f98d5d7788d300469a5f (patch) | |
tree | d4da991cd0b62743880c764bd4db77f6de2752d5 /fs | |
parent | 584f60ba22f79c89e6708ab82a5b5d9b8fa21fb2 (diff) | |
download | linux-4d89b6716b00bf52e2c4f98d5d7788d300469a5f.tar.xz |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ntfs3/frecord.c | 13 | ||||
-rw-r--r-- | fs/ntfs3/inode.c | 2 | ||||
-rw-r--r-- | fs/ntfs3/ntfs_fs.h | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index de9ef8c211ed..7962471692e6 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -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; } diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 74f6c7e567e7..68dd71eed3fe 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -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; } diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 7ad02f2dde2a..e2a3ecc12247 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -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); |