diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-05-24 19:55:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-05-24 19:55:07 -0700 |
commit | fdaf9a5840acaab18694a19e0eb0aa51162eeeed (patch) | |
tree | a027770138bccf9114cc83bafaa57accc13c91a6 /fs/orangefs/inode.c | |
parent | 8642174b52214dde4d8113f28fb4c9be5a432126 (diff) | |
parent | 516edb456f121e819d2130571004ed82f9566c4d (diff) | |
download | lwn-fdaf9a5840acaab18694a19e0eb0aa51162eeeed.tar.gz lwn-fdaf9a5840acaab18694a19e0eb0aa51162eeeed.zip |
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/orangefs/inode.c')
-rw-r--r-- | fs/orangefs/inode.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 79c1025d18ea..5ce27dde3c79 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -288,47 +288,45 @@ static void orangefs_readahead(struct readahead_control *rac) } } -static int orangefs_readpage(struct file *file, struct page *page) +static int orangefs_read_folio(struct file *file, struct folio *folio) { - struct folio *folio = page_folio(page); - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct iov_iter iter; struct bio_vec bv; ssize_t ret; - loff_t off; /* offset into this page */ + loff_t off; /* offset of this folio in the file */ if (folio_test_dirty(folio)) orangefs_launder_folio(folio); - off = page_offset(page); - bv.bv_page = page; - bv.bv_len = PAGE_SIZE; + off = folio_pos(folio); + bv.bv_page = &folio->page; + bv.bv_len = folio_size(folio); bv.bv_offset = 0; - iov_iter_bvec(&iter, READ, &bv, 1, PAGE_SIZE); + iov_iter_bvec(&iter, READ, &bv, 1, folio_size(folio)); ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter, - PAGE_SIZE, inode->i_size, NULL, NULL, file); + folio_size(folio), inode->i_size, NULL, NULL, file); /* this will only zero remaining unread portions of the page data */ iov_iter_zero(~0U, &iter); /* takes care of potential aliasing */ - flush_dcache_page(page); + flush_dcache_folio(folio); if (ret < 0) { - SetPageError(page); + folio_set_error(folio); } else { - SetPageUptodate(page); - if (PageError(page)) - ClearPageError(page); + folio_mark_uptodate(folio); + if (folio_test_error(folio)) + folio_clear_error(folio); ret = 0; } - /* unlock the page after the ->readpage() routine completes */ - unlock_page(page); + /* unlock the folio after the ->read_folio() routine completes */ + folio_unlock(folio); return ret; } static int orangefs_write_begin(struct file *file, - struct address_space *mapping, - loff_t pos, unsigned len, unsigned flags, struct page **pagep, - void **fsdata) + struct address_space *mapping, loff_t pos, unsigned len, + struct page **pagep, void **fsdata) { struct orangefs_write_range *wr; struct folio *folio; @@ -338,7 +336,7 @@ static int orangefs_write_begin(struct file *file, index = pos >> PAGE_SHIFT; - page = grab_cache_page_write_begin(mapping, index, flags); + page = grab_cache_page_write_begin(mapping, index); if (!page) return -ENOMEM; @@ -487,14 +485,14 @@ static void orangefs_invalidate_folio(struct folio *folio, orangefs_launder_folio(folio); } -static int orangefs_releasepage(struct page *page, gfp_t foo) +static bool orangefs_release_folio(struct folio *folio, gfp_t foo) { - return !PagePrivate(page); + return !folio_test_private(folio); } -static void orangefs_freepage(struct page *page) +static void orangefs_free_folio(struct folio *folio) { - kfree(detach_page_private(page)); + kfree(folio_detach_private(folio)); } static int orangefs_launder_folio(struct folio *folio) @@ -632,14 +630,14 @@ out: static const struct address_space_operations orangefs_address_operations = { .writepage = orangefs_writepage, .readahead = orangefs_readahead, - .readpage = orangefs_readpage, + .read_folio = orangefs_read_folio, .writepages = orangefs_writepages, .dirty_folio = filemap_dirty_folio, .write_begin = orangefs_write_begin, .write_end = orangefs_write_end, .invalidate_folio = orangefs_invalidate_folio, - .releasepage = orangefs_releasepage, - .freepage = orangefs_freepage, + .release_folio = orangefs_release_folio, + .free_folio = orangefs_free_folio, .launder_folio = orangefs_launder_folio, .direct_IO = orangefs_direct_IO, }; |