This is straightforward because netfs already worked in terms of folios.
Unified · Split
| @@ -336,7 +336,7 @@ static bool v9fs_dirty_folio(struct address_space *mapping, struct folio *folio) · 335 unmodified lines | |||
| 336 | #endif | 336 | #endif |
| 337 | 337 | ||
| 338 | const struct address_space_operations v9fs_addr_operations = { | 338 | const struct address_space_operations v9fs_addr_operations = { |
| 339 | .readpage = netfs_readpage, | 339 | .read_folio = netfs_read_folio, |
| 340 | .readahead = netfs_readahead, | 340 | .readahead = netfs_readahead, |
| 341 | .dirty_folio = v9fs_dirty_folio, | 341 | .dirty_folio = v9fs_dirty_folio, |
| 342 | .writepage = v9fs_vfs_writepage, | 342 | .writepage = v9fs_vfs_writepage, |
| @@ -50,7 +50,7 @@ const struct inode_operations afs_file_inode_operations = { · 49 unmodified lines | |||
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | const struct address_space_operations afs_file_aops = { | 52 | const struct address_space_operations afs_file_aops = { |
| 53 | .readpage = netfs_readpage, | 53 | .read_folio = netfs_read_folio, |
| 54 | .readahead = netfs_readahead, | 54 | .readahead = netfs_readahead, |
| 55 | .dirty_folio = afs_dirty_folio, | 55 | .dirty_folio = afs_dirty_folio, |
| 56 | .launder_folio = afs_launder_folio, | 56 | .launder_folio = afs_launder_folio, |
| @@ -1372,7 +1372,7 @@ out: · 1371 unmodified lines | |||
| 1372 | } | 1372 | } |
| 1373 | 1373 | ||
| 1374 | const struct address_space_operations ceph_aops = { | 1374 | const struct address_space_operations ceph_aops = { |
| 1375 | .readpage = netfs_readpage, | 1375 | .read_folio = netfs_read_folio, |
| 1376 | .readahead = netfs_readahead, | 1376 | .readahead = netfs_readahead, |
| 1377 | .writepage = ceph_writepage, | 1377 | .writepage = ceph_writepage, |
| 1378 | .writepages = ceph_writepages_start, | 1378 | .writepages = ceph_writepages_start, |
| @@ -198,22 +198,21 @@ cleanup_free: · 197 unmodified lines | |||
| 198 | EXPORT_SYMBOL(netfs_readahead); | 198 | EXPORT_SYMBOL(netfs_readahead); |
| 199 | 199 | ||
| 200 | /** | 200 | /** |
| 201 | * netfs_readpage - Helper to manage a readpage request | 201 | * netfs_read_folio - Helper to manage a read_folio request |
| 202 | * @file: The file to read from | 202 | * @file: The file to read from |
| 203 | * @subpage: A subpage of the folio to read | 203 | * @folio: The folio to read |
| 204 | * | 204 | * |
| 205 | * Fulfil a readpage request by drawing data from the cache if possible, or the | 205 | * Fulfil a read_folio request by drawing data from the cache if |
| 206 | * netfs if not. Space beyond the EOF is zero-filled. Multiple I/O requests | 206 | * possible, or the netfs if not. Space beyond the EOF is zero-filled. |
| 207 | * from different sources will get munged together. | 207 | * Multiple I/O requests from different sources will get munged together. |
| 208 | * | 208 | * |
| 209 | * The calling netfs must initialise a netfs context contiguous to the vfs | 209 | * The calling netfs must initialise a netfs context contiguous to the vfs |
| 210 | * inode before calling this. | 210 | * inode before calling this. |
| 211 | * | 211 | * |
| 212 | * This is usable whether or not caching is enabled. | 212 | * This is usable whether or not caching is enabled. |
| 213 | */ | 213 | */ |
| 214 | int netfs_readpage(struct file *file, struct page *subpage) | 214 | int netfs_read_folio(struct file *file, struct folio *folio) |
| 215 | { | 215 | { |
| 216 | struct folio *folio = page_folio(subpage); | ||
| 217 | struct address_space *mapping = folio_file_mapping(folio); | 216 | struct address_space *mapping = folio_file_mapping(folio); |
| 218 | struct netfs_io_request *rreq; | 217 | struct netfs_io_request *rreq; |
| 219 | struct netfs_i_context *ctx = netfs_i_context(mapping->host); | 218 | struct netfs_i_context *ctx = netfs_i_context(mapping->host); |
| @@ -245,7 +244,7 @@ alloc_error: · 25 unmodified lines | |||
| 245 | folio_unlock(folio); | 244 | folio_unlock(folio); |
| 246 | return ret; | 245 | return ret; |
| 247 | } | 246 | } |
| 248 | EXPORT_SYMBOL(netfs_readpage); | 247 | EXPORT_SYMBOL(netfs_read_folio); |
| 249 | 248 | ||
| 250 | /* | 249 | /* |
| 251 | * Prepare a folio for writing without reading first | 250 | * Prepare a folio for writing without reading first |
| @@ -274,7 +274,7 @@ struct netfs_cache_ops { · 273 unmodified lines | |||
| 274 | 274 | ||
| 275 | struct readahead_control; | 275 | struct readahead_control; |
| 276 | extern void netfs_readahead(struct readahead_control *); | 276 | extern void netfs_readahead(struct readahead_control *); |
| 277 | extern int netfs_readpage(struct file *, struct page *); | 277 | int netfs_read_folio(struct file *, struct folio *); |
| 278 | extern int netfs_write_begin(struct file *, struct address_space *, | 278 | extern int netfs_write_begin(struct file *, struct address_space *, |
| 279 | loff_t, unsigned int, struct folio **, | 279 | loff_t, unsigned int, struct folio **, |
| 280 | void **); | 280 | void **); |