ubifs: Convert ubifs to read_folio

This is a "weak" conversion which converts straight back to using pages.
A full conversion should be performed at some point, hopefully by
someone familiar with the filesystem.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2022-04-29 11:12:16 -04:00
parent 124cfc154f
commit 0b7bf4830a
2 changed files with 8 additions and 6 deletions

View File

@ -31,9 +31,9 @@
* in the "sys_write -> alloc_pages -> direct reclaim path". So, in * in the "sys_write -> alloc_pages -> direct reclaim path". So, in
* 'ubifs_writepage()' we are only guaranteed that the page is locked. * 'ubifs_writepage()' we are only guaranteed that the page is locked.
* *
* Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the * Similarly, @i_mutex is not always locked in 'ubifs_read_folio()', e.g., the
* read-ahead path does not lock it ("sys_read -> generic_file_aio_read -> * read-ahead path does not lock it ("sys_read -> generic_file_aio_read ->
* ondemand_readahead -> readpage"). In case of readahead, @I_SYNC flag is not * ondemand_readahead -> read_folio"). In case of readahead, @I_SYNC flag is not
* set as well. However, UBIFS disables readahead. * set as well. However, UBIFS disables readahead.
*/ */
@ -889,12 +889,14 @@ static int ubifs_bulk_read(struct page *page)
return err; return err;
} }
static int ubifs_readpage(struct file *file, struct page *page) static int ubifs_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page;
if (ubifs_bulk_read(page)) if (ubifs_bulk_read(page))
return 0; return 0;
do_readpage(page); do_readpage(page);
unlock_page(page); folio_unlock(folio);
return 0; return 0;
} }
@ -1641,7 +1643,7 @@ static int ubifs_symlink_getattr(struct user_namespace *mnt_userns,
} }
const struct address_space_operations ubifs_file_address_operations = { const struct address_space_operations ubifs_file_address_operations = {
.readpage = ubifs_readpage, .read_folio = ubifs_read_folio,
.writepage = ubifs_writepage, .writepage = ubifs_writepage,
.write_begin = ubifs_write_begin, .write_begin = ubifs_write_begin,
.write_end = ubifs_write_end, .write_end = ubifs_write_end,

View File

@ -2191,7 +2191,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
/* /*
* UBIFS provides 'backing_dev_info' in order to disable read-ahead. For * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For
* UBIFS, I/O is not deferred, it is done immediately in readpage, * UBIFS, I/O is not deferred, it is done immediately in read_folio,
* which means the user would have to wait not just for their own I/O * which means the user would have to wait not just for their own I/O
* but the read-ahead I/O as well i.e. completely pointless. * but the read-ahead I/O as well i.e. completely pointless.
* *