summaryrefslogtreecommitdiff
path: root/fs/ext4/inline.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2023-03-24 21:01:13 +0300
committerTheodore Ts'o <tytso@mit.edu>2023-04-06 20:39:51 +0300
commit9a9d01f081ea29a5a8afc4504b1bc48daffa5cc1 (patch)
tree47e9b187df79ea76725b0f0399f8fbeaad80499e /fs/ext4/inline.c
parent4ed9b598ac30913987ab46e0069620e6e8af82f0 (diff)
downloadlinux-9a9d01f081ea29a5a8afc4504b1bc48daffa5cc1.tar.xz
ext4: Convert ext4_da_write_inline_data_begin() to use a folio
Saves a number of calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Link: https://lore.kernel.org/r/20230324180129.1220691-14-willy@infradead.org Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r--fs/ext4/inline.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 45d74274d822..2fa6c51baef9 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -909,10 +909,9 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
{
int ret;
handle_t *handle;
- struct page *page;
+ struct folio *folio;
struct ext4_iloc iloc;
int retries = 0;
- unsigned int flags;
ret = ext4_get_inode_loc(inode, &iloc);
if (ret)
@@ -944,10 +943,9 @@ retry_journal:
* We cannot recurse into the filesystem as the transaction
* is already started.
*/
- flags = memalloc_nofs_save();
- page = grab_cache_page_write_begin(mapping, 0);
- memalloc_nofs_restore(flags);
- if (!page) {
+ folio = __filemap_get_folio(mapping, 0, FGP_WRITEBEGIN | FGP_NOFS,
+ mapping_gfp_mask(mapping));
+ if (!folio) {
ret = -ENOMEM;
goto out_journal;
}
@@ -958,8 +956,8 @@ retry_journal:
goto out_release_page;
}
- if (!PageUptodate(page)) {
- ret = ext4_read_inline_page(inode, page);
+ if (!folio_test_uptodate(folio)) {
+ ret = ext4_read_inline_page(inode, &folio->page);
if (ret < 0)
goto out_release_page;
}
@@ -969,13 +967,13 @@ retry_journal:
goto out_release_page;
up_read(&EXT4_I(inode)->xattr_sem);
- *pagep = page;
+ *pagep = &folio->page;
brelse(iloc.bh);
return 1;
out_release_page:
up_read(&EXT4_I(inode)->xattr_sem);
- unlock_page(page);
- put_page(page);
+ folio_unlock(folio);
+ folio_put(folio);
out_journal:
ext4_journal_stop(handle);
out: