[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230126202415.1682629-15-willy@infradead.org>
Date: Thu, 26 Jan 2023 20:23:58 +0000
From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
To: "Theodore Tso" <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 14/31] ext4: Convert ext4_read_inline_page() to ext4_read_inline_folio()
All callers now have a folio, so pass it and use it. The folio may
be large, although I doubt we'll want to use a large folio for an
inline file.
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
---
fs/ext4/inline.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index b8e22348dad2..29294caa20a1 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -468,16 +468,16 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,
return error;
}
-static int ext4_read_inline_page(struct inode *inode, struct page *page)
+static int ext4_read_inline_folio(struct inode *inode, struct folio *folio)
{
void *kaddr;
int ret = 0;
size_t len;
struct ext4_iloc iloc;
- BUG_ON(!PageLocked(page));
+ BUG_ON(!folio_test_locked(folio));
BUG_ON(!ext4_has_inline_data(inode));
- BUG_ON(page->index);
+ BUG_ON(folio->index);
if (!EXT4_I(inode)->i_inline_off) {
ext4_warning(inode->i_sb, "inode %lu doesn't have inline data.",
@@ -490,12 +490,13 @@ static int ext4_read_inline_page(struct inode *inode, struct page *page)
goto out;
len = min_t(size_t, ext4_get_inline_size(inode), i_size_read(inode));
- kaddr = kmap_atomic(page);
+ BUG_ON(len > PAGE_SIZE);
+ kaddr = kmap_local_folio(folio, 0);
ret = ext4_read_inline_data(inode, kaddr, len, &iloc);
- flush_dcache_page(page);
- kunmap_atomic(kaddr);
- zero_user_segment(page, len, PAGE_SIZE);
- SetPageUptodate(page);
+ flush_dcache_folio(folio);
+ kunmap_local(kaddr);
+ folio_zero_segment(folio, len, folio_size(folio));
+ folio_mark_uptodate(folio);
brelse(iloc.bh);
out:
@@ -517,7 +518,7 @@ int ext4_readpage_inline(struct inode *inode, struct folio *folio)
* So for all the other pages, just set them uptodate.
*/
if (!folio->index)
- ret = ext4_read_inline_page(inode, &folio->page);
+ ret = ext4_read_inline_folio(inode, folio);
else if (!folio_test_uptodate(folio)) {
folio_zero_segment(folio, 0, PAGE_SIZE);
folio_mark_uptodate(folio);
@@ -582,7 +583,7 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
from = 0;
to = ext4_get_inline_size(inode);
if (!folio_test_uptodate(folio)) {
- ret = ext4_read_inline_page(inode, &folio->page);
+ ret = ext4_read_inline_folio(inode, folio);
if (ret < 0)
goto out;
}
@@ -708,7 +709,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping,
}
if (!folio_test_uptodate(folio)) {
- ret = ext4_read_inline_page(inode, &folio->page);
+ ret = ext4_read_inline_folio(inode, folio);
if (ret < 0) {
folio_unlock(folio);
folio_put(folio);
@@ -865,7 +866,7 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,
inline_size = ext4_get_inline_size(inode);
if (!folio_test_uptodate(folio)) {
- ret = ext4_read_inline_page(inode, &folio->page);
+ ret = ext4_read_inline_folio(inode, folio);
if (ret < 0)
goto out;
}
@@ -958,7 +959,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
}
if (!folio_test_uptodate(folio)) {
- ret = ext4_read_inline_page(inode, &folio->page);
+ ret = ext4_read_inline_folio(inode, folio);
if (ret < 0)
goto out_release_page;
}
--
2.35.1
Powered by blists - more mailing lists