History

fs: Convert netfs_readpage to netfs_read_folio

This is straightforward because netfs already worked in terms of folios.

Matthew Wilcox (Oracle) committed 4 years ago

Commit 6c623711 parent 08830c85 files · +11 −12Browse files

Unified · Split

5 files
  1. fs/9p/vfs_addr.c +1 −1
  2. fs/afs/file.c +1 −1
  3. fs/ceph/addr.c +1 −1
  4. fs/netfs/buffered_read.c +7 −8
  5. include/linux/netfs.h +1 −1
fs/9p/vfs_addr.c+1−1
@@ -336,7 +336,7 @@ static bool v9fs_dirty_folio(struct address_space *mapping, struct folio *folio) · 335 unmodified lines
336#endif336#endif
337 337
338const struct address_space_operations v9fs_addr_operations = {338const 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,
fs/afs/file.c+1−1
@@ -50,7 +50,7 @@ const struct inode_operations afs_file_inode_operations = { · 49 unmodified lines
50};50};
51 51
52const struct address_space_operations afs_file_aops = {52const 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,
fs/ceph/addr.c+1−1
@@ -1372,7 +1372,7 @@ out: · 1371 unmodified lines
1372}1372}
1373 1373
1374const struct address_space_operations ceph_aops = {1374const 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,
fs/netfs/buffered_read.c+7−8
@@ -198,22 +198,21 @@ cleanup_free: · 197 unmodified lines
198EXPORT_SYMBOL(netfs_readahead);198EXPORT_SYMBOL(netfs_readahead);
199 199
200/**200/**
201 * netfs_readpage - Helper to manage a readpage request201 * netfs_read_folio - Helper to manage a read_folio request
202 * @file: The file to read from202 * @file: The file to read from
203 * @subpage: A subpage of the folio to read203 * @folio: The folio to read
204 *204 *
205 * Fulfil a readpage request by drawing data from the cache if possible, or the205 * 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 requests206 * 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 vfs209 * 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 */
214int netfs_readpage(struct file *file, struct page *subpage)214int 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}
248EXPORT_SYMBOL(netfs_readpage);247EXPORT_SYMBOL(netfs_read_folio);
249 248
250/*249/*
251 * Prepare a folio for writing without reading first250 * Prepare a folio for writing without reading first
include/linux/netfs.h+1−1
@@ -274,7 +274,7 @@ struct netfs_cache_ops { · 273 unmodified lines
274 274
275struct readahead_control;275struct readahead_control;
276extern void netfs_readahead(struct readahead_control *);276extern void netfs_readahead(struct readahead_control *);
277extern int netfs_readpage(struct file *, struct page *);277int netfs_read_folio(struct file *, struct folio *);
278extern int netfs_write_begin(struct file *, struct address_space *,278extern 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 **);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t