From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Jan Kara <jack@suse.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 6/7] udf: Convert udf_page_mkwrite() to use a folio
Date: Wed, 17 Apr 2024 16:04:12 +0100 [thread overview]
Message-ID: <20240417150416.752929-7-willy@infradead.org> (raw)
In-Reply-To: <20240417150416.752929-1-willy@infradead.org>
Convert the vm_fault page to a folio, then use it throughout.
Replaces five calls to compound_head() with one.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/udf/file.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 0ceac4b5937c..97c59585208c 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -39,7 +39,7 @@ static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf)
struct vm_area_struct *vma = vmf->vma;
struct inode *inode = file_inode(vma->vm_file);
struct address_space *mapping = inode->i_mapping;
- struct page *page = vmf->page;
+ struct folio *folio = page_folio(vmf->page);
loff_t size;
unsigned int end;
vm_fault_t ret = VM_FAULT_LOCKED;
@@ -48,31 +48,31 @@ static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf)
sb_start_pagefault(inode->i_sb);
file_update_time(vma->vm_file);
filemap_invalidate_lock_shared(mapping);
- lock_page(page);
+ folio_lock(folio);
size = i_size_read(inode);
- if (page->mapping != inode->i_mapping || page_offset(page) >= size) {
- unlock_page(page);
+ if (folio->mapping != inode->i_mapping || folio_pos(folio) >= size) {
+ folio_unlock(folio);
ret = VM_FAULT_NOPAGE;
goto out_unlock;
}
/* Space is already allocated for in-ICB file */
if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
goto out_dirty;
- if (page->index == size >> PAGE_SHIFT)
+ if (folio->index == size >> PAGE_SHIFT)
end = size & ~PAGE_MASK;
else
end = PAGE_SIZE;
- err = __block_write_begin(page, 0, end, udf_get_block);
+ err = __block_write_begin(&folio->page, 0, end, udf_get_block);
if (err) {
- unlock_page(page);
+ folio_unlock(folio);
ret = vmf_fs_error(err);
goto out_unlock;
}
- block_commit_write(page, 0, end);
+ block_commit_write(&folio->page, 0, end);
out_dirty:
- set_page_dirty(page);
- wait_for_stable_page(page);
+ folio_mark_dirty(folio);
+ folio_wait_stable(folio);
out_unlock:
filemap_invalidate_unlock_shared(mapping);
sb_end_pagefault(inode->i_sb);
--
2.43.0
next prev parent reply other threads:[~2024-04-17 15:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 15:04 [PATCH 0/7] Convert UDF to folios Matthew Wilcox (Oracle)
2024-04-17 15:04 ` [PATCH 1/7] udf: Convert udf_symlink_filler() to use a folio Matthew Wilcox (Oracle)
2024-04-18 10:37 ` Jan Kara
2024-04-18 12:27 ` Matthew Wilcox
2024-04-17 15:04 ` [PATCH 2/7] udf: Convert udf_write_begin() " Matthew Wilcox (Oracle)
2024-04-17 15:04 ` [PATCH 3/7] udf: Convert udf_expand_file_adinicb() " Matthew Wilcox (Oracle)
2024-04-18 10:44 ` Jan Kara
2024-04-17 15:04 ` [PATCH 4/7] udf: Convert udf_adinicb_readpage() to udf_adinicb_read_folio() Matthew Wilcox (Oracle)
2024-04-18 10:50 ` Jan Kara
2024-04-18 12:29 ` Matthew Wilcox
2024-04-19 8:50 ` Jan Kara
2024-04-17 15:04 ` [PATCH 5/7] udf: Convert udf_symlink_getattr() to use a folio Matthew Wilcox (Oracle)
2024-04-17 15:04 ` Matthew Wilcox (Oracle) [this message]
2024-04-17 15:04 ` [PATCH 7/7] udf: Use a folio in udf_write_end() Matthew Wilcox (Oracle)
2024-04-18 10:53 ` [PATCH 0/7] Convert UDF to folios Jan Kara
2024-04-23 13:44 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240417150416.752929-7-willy@infradead.org \
--to=willy@infradead.org \
--cc=jack@suse.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).