Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+8 -6
+7 -5
fs/ubifs/file.c
··· 31 31 * in the "sys_write -> alloc_pages -> direct reclaim path". So, in 32 32 * 'ubifs_writepage()' we are only guaranteed that the page is locked. 33 33 * 34 - * Similarly, @i_mutex is not always locked in 'ubifs_readpage()', e.g., the 34 + * Similarly, @i_mutex is not always locked in 'ubifs_read_folio()', e.g., the 35 35 * read-ahead path does not lock it ("sys_read -> generic_file_aio_read -> 36 - * ondemand_readahead -> readpage"). In case of readahead, @I_SYNC flag is not 36 + * ondemand_readahead -> read_folio"). In case of readahead, @I_SYNC flag is not 37 37 * set as well. However, UBIFS disables readahead. 38 38 */ 39 39 ··· 889 889 return err; 890 890 } 891 891 892 - static int ubifs_readpage(struct file *file, struct page *page) 892 + static int ubifs_read_folio(struct file *file, struct folio *folio) 893 893 { 894 + struct page *page = &folio->page; 895 + 894 896 if (ubifs_bulk_read(page)) 895 897 return 0; 896 898 do_readpage(page); 897 - unlock_page(page); 899 + folio_unlock(folio); 898 900 return 0; 899 901 } 900 902 ··· 1643 1641 } 1644 1642 1645 1643 const struct address_space_operations ubifs_file_address_operations = { 1646 - .readpage = ubifs_readpage, 1644 + .read_folio = ubifs_read_folio, 1647 1645 .writepage = ubifs_writepage, 1648 1646 .write_begin = ubifs_write_begin, 1649 1647 .write_end = ubifs_write_end,
+1 -1
fs/ubifs/super.c
··· 2191 2191 2192 2192 /* 2193 2193 * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For 2194 - * UBIFS, I/O is not deferred, it is done immediately in readpage, 2194 + * UBIFS, I/O is not deferred, it is done immediately in read_folio, 2195 2195 * which means the user would have to wait not just for their own I/O 2196 2196 * but the read-ahead I/O as well i.e. completely pointless. 2197 2197 *