Message ID | 20241125180117.2914311-1-willy@infradead.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | isofs: Partially convert zisofs_read_folio to use a folio | expand |
On Mon 25-11-24 18:01:14, Matthew Wilcox (Oracle) wrote: > Remove several hidden calls to compound_head() and references > to page->index. More needs to be done to use folios throughout > the zisofs code. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Thanks! Added to my tree. Honza > --- > fs/isofs/compress.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c > index 34d5baa5d88a..5f3b6da0e022 100644 > --- a/fs/isofs/compress.c > +++ b/fs/isofs/compress.c > @@ -301,7 +301,6 @@ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount, > */ > static int zisofs_read_folio(struct file *file, struct folio *folio) > { > - struct page *page = &folio->page; > struct inode *inode = file_inode(file); > struct address_space *mapping = inode->i_mapping; > int err; > @@ -311,16 +310,15 @@ static int zisofs_read_folio(struct file *file, struct folio *folio) > PAGE_SHIFT <= zisofs_block_shift ? > (1 << (zisofs_block_shift - PAGE_SHIFT)) : 0; > struct page **pages; > - pgoff_t index = page->index, end_index; > + pgoff_t index = folio->index, end_index; > > end_index = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT; > /* > - * If this page is wholly outside i_size we just return zero; > + * If this folio is wholly outside i_size we just return zero; > * do_generic_file_read() will handle this for us > */ > if (index >= end_index) { > - SetPageUptodate(page); > - unlock_page(page); > + folio_end_read(folio, true); > return 0; > } > > @@ -338,10 +336,10 @@ static int zisofs_read_folio(struct file *file, struct folio *folio) > pages = kcalloc(max_t(unsigned int, zisofs_pages_per_cblock, 1), > sizeof(*pages), GFP_KERNEL); > if (!pages) { > - unlock_page(page); > + folio_unlock(folio); > return -ENOMEM; > } > - pages[full_page] = page; > + pages[full_page] = &folio->page; > > for (i = 0; i < pcount; i++, index++) { > if (i != full_page) > -- > 2.45.2 >
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c index 34d5baa5d88a..5f3b6da0e022 100644 --- a/fs/isofs/compress.c +++ b/fs/isofs/compress.c @@ -301,7 +301,6 @@ static int zisofs_fill_pages(struct inode *inode, int full_page, int pcount, */ static int zisofs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; struct inode *inode = file_inode(file); struct address_space *mapping = inode->i_mapping; int err; @@ -311,16 +310,15 @@ static int zisofs_read_folio(struct file *file, struct folio *folio) PAGE_SHIFT <= zisofs_block_shift ? (1 << (zisofs_block_shift - PAGE_SHIFT)) : 0; struct page **pages; - pgoff_t index = page->index, end_index; + pgoff_t index = folio->index, end_index; end_index = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT; /* - * If this page is wholly outside i_size we just return zero; + * If this folio is wholly outside i_size we just return zero; * do_generic_file_read() will handle this for us */ if (index >= end_index) { - SetPageUptodate(page); - unlock_page(page); + folio_end_read(folio, true); return 0; } @@ -338,10 +336,10 @@ static int zisofs_read_folio(struct file *file, struct folio *folio) pages = kcalloc(max_t(unsigned int, zisofs_pages_per_cblock, 1), sizeof(*pages), GFP_KERNEL); if (!pages) { - unlock_page(page); + folio_unlock(folio); return -ENOMEM; } - pages[full_page] = page; + pages[full_page] = &folio->page; for (i = 0; i < pcount; i++, index++) { if (i != full_page)
Remove several hidden calls to compound_head() and references to page->index. More needs to be done to use folios throughout the zisofs code. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- fs/isofs/compress.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)