From: Christoph Hellwig <hch@lst.de>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/2] ntfs3: stop using generic_writepages
Date: Wed, 16 Nov 2022 14:34:51 +0100 [thread overview]
Message-ID: <20221116133452.2196640-2-hch@lst.de> (raw)
In-Reply-To: <20221116133452.2196640-1-hch@lst.de>
Open code the resident inode handling in ntfs_writepages by directly
using write_cache_pages to prepare removing the ->writepage handler
in ntfs3.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/ntfs3/inode.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index d5a3afbbbfd8c..7a869e2a98620 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -846,12 +846,29 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
return block_write_full_page(page, ntfs_get_block, wbc);
}
+static int ntfs_resident_writepage(struct page *page,
+ struct writeback_control *wbc, void *data)
+{
+ struct address_space *mapping = data;
+ struct ntfs_inode *ni = ntfs_i(mapping->host);
+ int ret;
+
+ ni_lock(ni);
+ ret = attr_data_write_resident(ni, page);
+ ni_unlock(ni);
+
+ if (ret != E_NTFS_NONRESIDENT)
+ unlock_page(page);
+ mapping_set_error(mapping, ret);
+ return ret;
+}
+
static int ntfs_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
- /* Redirect call to 'ntfs_writepage' for resident files. */
if (is_resident(ntfs_i(mapping->host)))
- return generic_writepages(mapping, wbc);
+ return write_cache_pages(mapping, wbc, ntfs_resident_writepage,
+ mapping);
return mpage_writepages(mapping, wbc, ntfs_get_block);
}
--
2.30.2
next prev parent reply other threads:[~2022-11-16 13:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 13:34 remove ->writepage in ntfs3 Christoph Hellwig
2022-11-16 13:34 ` Christoph Hellwig [this message]
2022-11-16 13:34 ` [PATCH 2/2] ntfs3: remove ->writepage Christoph Hellwig
2022-12-04 8:17 ` remove ->writepage in ntfs3 Christoph Hellwig
2022-12-30 12:03 ` Konstantin Komarov
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=20221116133452.2196640-2-hch@lst.de \
--to=hch@lst.de \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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