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 3/7] udf: Convert udf_expand_file_adinicb() to use a folio
Date: Wed, 17 Apr 2024 16:04:09 +0100 [thread overview]
Message-ID: <20240417150416.752929-4-willy@infradead.org> (raw)
In-Reply-To: <20240417150416.752929-1-willy@infradead.org>
Use the folio APIs throughout this function.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/udf/inode.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 5146b9d7aba3..59215494e6f6 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -342,7 +342,7 @@ const struct address_space_operations udf_aops = {
*/
int udf_expand_file_adinicb(struct inode *inode)
{
- struct page *page;
+ struct folio *folio;
struct udf_inode_info *iinfo = UDF_I(inode);
int err;
@@ -358,12 +358,13 @@ int udf_expand_file_adinicb(struct inode *inode)
return 0;
}
- page = find_or_create_page(inode->i_mapping, 0, GFP_KERNEL);
- if (!page)
- return -ENOMEM;
+ folio = __filemap_get_folio(inode->i_mapping, 0,
+ FGP_LOCK | FGP_ACCESSED | FGP_CREAT, GFP_KERNEL);
+ if (IS_ERR(folio))
+ return PTR_ERR(folio);
- if (!PageUptodate(page))
- udf_adinicb_readpage(page);
+ if (!folio_test_uptodate(folio))
+ udf_adinicb_readpage(&folio->page);
down_write(&iinfo->i_data_sem);
memset(iinfo->i_data + iinfo->i_lenEAttr, 0x00,
iinfo->i_lenAlloc);
@@ -372,22 +373,22 @@ int udf_expand_file_adinicb(struct inode *inode)
iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
else
iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
- set_page_dirty(page);
- unlock_page(page);
+ folio_mark_dirty(folio);
+ folio_unlock(folio);
up_write(&iinfo->i_data_sem);
err = filemap_fdatawrite(inode->i_mapping);
if (err) {
/* Restore everything back so that we don't lose data... */
- lock_page(page);
+ folio_lock(folio);
down_write(&iinfo->i_data_sem);
- memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr,
- inode->i_size);
- unlock_page(page);
+ memcpy_from_folio(iinfo->i_data + iinfo->i_lenEAttr,
+ folio, 0, inode->i_size);
+ folio_unlock(folio);
iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
iinfo->i_lenAlloc = inode->i_size;
up_write(&iinfo->i_data_sem);
}
- put_page(page);
+ folio_put(folio);
mark_inode_dirty(inode);
return err;
--
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 ` Matthew Wilcox (Oracle) [this message]
2024-04-18 10:44 ` [PATCH 3/7] udf: Convert udf_expand_file_adinicb() " 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 ` [PATCH 6/7] udf: Convert udf_page_mkwrite() " Matthew Wilcox (Oracle)
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-4-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).