diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-05-25 05:55:07 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-05-25 05:55:07 +0300 |
commit | fdaf9a5840acaab18694a19e0eb0aa51162eeeed (patch) | |
tree | a027770138bccf9114cc83bafaa57accc13c91a6 /fs/afs | |
parent | 8642174b52214dde4d8113f28fb4c9be5a432126 (diff) | |
parent | 516edb456f121e819d2130571004ed82f9566c4d (diff) | |
download | linux-fdaf9a5840acaab18694a19e0eb0aa51162eeeed.tar.xz |
Merge tag 'folio-5.19' of git://git.infradead.org/users/willy/pagecache
Pull page cache updates from Matthew Wilcox:
- Appoint myself page cache maintainer
- Fix how scsicam uses the page cache
- Use the memalloc_nofs_save() API to replace AOP_FLAG_NOFS
- Remove the AOP flags entirely
- Remove pagecache_write_begin() and pagecache_write_end()
- Documentation updates
- Convert several address_space operations to use folios:
- is_dirty_writeback
- readpage becomes read_folio
- releasepage becomes release_folio
- freepage becomes free_folio
- Change filler_t to require a struct file pointer be the first
argument like ->read_folio
* tag 'folio-5.19' of git://git.infradead.org/users/willy/pagecache: (107 commits)
nilfs2: Fix some kernel-doc comments
Appoint myself page cache maintainer
fs: Remove aops->freepage
secretmem: Convert to free_folio
nfs: Convert to free_folio
orangefs: Convert to free_folio
fs: Add free_folio address space operation
fs: Convert drop_buffers() to use a folio
fs: Change try_to_free_buffers() to take a folio
jbd2: Convert release_buffer_page() to use a folio
jbd2: Convert jbd2_journal_try_to_free_buffers to take a folio
reiserfs: Convert release_buffer_page() to use a folio
fs: Remove last vestiges of releasepage
ubifs: Convert to release_folio
reiserfs: Convert to release_folio
orangefs: Convert to release_folio
ocfs2: Convert to release_folio
nilfs2: Remove comment about releasepage
nfs: Convert to release_folio
jfs: Convert to release_folio
...
Diffstat (limited to 'fs/afs')
-rw-r--r-- | fs/afs/dir.c | 7 | ||||
-rw-r--r-- | fs/afs/file.c | 28 | ||||
-rw-r--r-- | fs/afs/internal.h | 4 | ||||
-rw-r--r-- | fs/afs/write.c | 4 |
4 files changed, 20 insertions, 23 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 932e61e28e5d..94aa7356248e 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -41,7 +41,7 @@ static int afs_symlink(struct user_namespace *mnt_userns, struct inode *dir, static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags); -static int afs_dir_releasepage(struct page *page, gfp_t gfp_flags); +static bool afs_dir_release_folio(struct folio *folio, gfp_t gfp_flags); static void afs_dir_invalidate_folio(struct folio *folio, size_t offset, size_t length); @@ -75,7 +75,7 @@ const struct inode_operations afs_dir_inode_operations = { const struct address_space_operations afs_dir_aops = { .dirty_folio = afs_dir_dirty_folio, - .releasepage = afs_dir_releasepage, + .release_folio = afs_dir_release_folio, .invalidate_folio = afs_dir_invalidate_folio, }; @@ -2002,9 +2002,8 @@ error: * Release a directory folio and clean up its private state if it's not busy * - return true if the folio can now be released, false if not */ -static int afs_dir_releasepage(struct page *subpage, gfp_t gfp_flags) +static bool afs_dir_release_folio(struct folio *folio, gfp_t gfp_flags) { - struct folio *folio = page_folio(subpage); struct afs_vnode *dvnode = AFS_FS_I(folio_inode(folio)); _enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, folio_index(folio)); diff --git a/fs/afs/file.c b/fs/afs/file.c index 26292a110a8f..a8e8832179e4 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -19,10 +19,10 @@ #include "internal.h" static int afs_file_mmap(struct file *file, struct vm_area_struct *vma); -static int afs_symlink_readpage(struct file *file, struct page *page); +static int afs_symlink_read_folio(struct file *file, struct folio *folio); static void afs_invalidate_folio(struct folio *folio, size_t offset, size_t length); -static int afs_releasepage(struct page *page, gfp_t gfp_flags); +static bool afs_release_folio(struct folio *folio, gfp_t gfp_flags); static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter); static void afs_vm_open(struct vm_area_struct *area); @@ -50,11 +50,11 @@ const struct inode_operations afs_file_inode_operations = { }; const struct address_space_operations afs_file_aops = { - .readpage = netfs_readpage, + .read_folio = netfs_read_folio, .readahead = netfs_readahead, .dirty_folio = afs_dirty_folio, .launder_folio = afs_launder_folio, - .releasepage = afs_releasepage, + .release_folio = afs_release_folio, .invalidate_folio = afs_invalidate_folio, .write_begin = afs_write_begin, .write_end = afs_write_end, @@ -63,8 +63,8 @@ const struct address_space_operations afs_file_aops = { }; const struct address_space_operations afs_symlink_aops = { - .readpage = afs_symlink_readpage, - .releasepage = afs_releasepage, + .read_folio = afs_symlink_read_folio, + .release_folio = afs_release_folio, .invalidate_folio = afs_invalidate_folio, }; @@ -332,11 +332,10 @@ static void afs_issue_read(struct netfs_io_subrequest *subreq) afs_put_read(fsreq); } -static int afs_symlink_readpage(struct file *file, struct page *page) +static int afs_symlink_read_folio(struct file *file, struct folio *folio) { - struct afs_vnode *vnode = AFS_FS_I(page->mapping->host); + struct afs_vnode *vnode = AFS_FS_I(folio->mapping->host); struct afs_read *fsreq; - struct folio *folio = page_folio(page); int ret; fsreq = afs_alloc_read(GFP_NOFS); @@ -347,13 +346,13 @@ static int afs_symlink_readpage(struct file *file, struct page *page) fsreq->len = folio_size(folio); fsreq->vnode = vnode; fsreq->iter = &fsreq->def_iter; - iov_iter_xarray(&fsreq->def_iter, READ, &page->mapping->i_pages, + iov_iter_xarray(&fsreq->def_iter, READ, &folio->mapping->i_pages, fsreq->pos, fsreq->len); ret = afs_fetch_data(fsreq->vnode, fsreq); if (ret == 0) - SetPageUptodate(page); - unlock_page(page); + folio_mark_uptodate(folio); + folio_unlock(folio); return ret; } @@ -482,16 +481,15 @@ static void afs_invalidate_folio(struct folio *folio, size_t offset, * release a page and clean up its private state if it's not busy * - return true if the page can now be released, false if not */ -static int afs_releasepage(struct page *page, gfp_t gfp) +static bool afs_release_folio(struct folio *folio, gfp_t gfp) { - struct folio *folio = page_folio(page); struct afs_vnode *vnode = AFS_FS_I(folio_inode(folio)); _enter("{{%llx:%llu}[%lu],%lx},%x", vnode->fid.vid, vnode->fid.vnode, folio_index(folio), folio->flags, gfp); - /* deny if page is being written to the cache and the caller hasn't + /* deny if folio is being written to the cache and the caller hasn't * elected to wait */ #ifdef CONFIG_AFS_FSCACHE if (folio_test_fscache(folio)) { diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 7b7ef945dc78..a30995901266 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -311,7 +311,7 @@ struct afs_net { atomic_t n_lookup; /* Number of lookups done */ atomic_t n_reval; /* Number of dentries needing revalidation */ atomic_t n_inval; /* Number of invalidations by the server */ - atomic_t n_relpg; /* Number of invalidations by releasepage */ + atomic_t n_relpg; /* Number of invalidations by release_folio */ atomic_t n_read_dir; /* Number of directory pages read */ atomic_t n_dir_cr; /* Number of directory entry creation edits */ atomic_t n_dir_rm; /* Number of directory entry removal edits */ @@ -1535,7 +1535,7 @@ bool afs_dirty_folio(struct address_space *, struct folio *); #define afs_dirty_folio filemap_dirty_folio #endif extern int afs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **pagep, void **fsdata); extern int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, diff --git a/fs/afs/write.c b/fs/afs/write.c index 4763132ca57e..5224e346fbad 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -42,7 +42,7 @@ static void afs_folio_start_fscache(bool caching, struct folio *folio) * prepare to perform part of a write to a page */ int afs_write_begin(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned len, struct page **_page, void **fsdata) { struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); @@ -60,7 +60,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, * file. We need to do this before we get a lock on the page in case * there's more than one writer competing for the same cache block. */ - ret = netfs_write_begin(file, mapping, pos, len, flags, &folio, fsdata); + ret = netfs_write_begin(file, mapping, pos, len, &folio, fsdata); if (ret < 0) return ret; |