* remove ->writepage in ntfs3
@ 2022-11-16 13:34 Christoph Hellwig
2022-11-16 13:34 ` [PATCH 1/2] ntfs3: stop using generic_writepages Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-11-16 13:34 UTC (permalink / raw)
To: Konstantin Komarov; +Cc: ntfs3, linux-fsdevel
Hi Konstantin,
this small series removes the deprecated ->writepage method from ntfs3.
I don't have a ntfs test setup so this is untested and should be handled
with care.
Diffstat:
inode.c | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ntfs3: stop using generic_writepages
2022-11-16 13:34 remove ->writepage in ntfs3 Christoph Hellwig
@ 2022-11-16 13:34 ` Christoph Hellwig
2022-11-16 13:34 ` [PATCH 2/2] ntfs3: remove ->writepage Christoph Hellwig
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-11-16 13:34 UTC (permalink / raw)
To: Konstantin Komarov; +Cc: ntfs3, linux-fsdevel
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ntfs3: remove ->writepage
2022-11-16 13:34 remove ->writepage in ntfs3 Christoph Hellwig
2022-11-16 13:34 ` [PATCH 1/2] ntfs3: stop using generic_writepages Christoph Hellwig
@ 2022-11-16 13:34 ` Christoph Hellwig
2022-12-04 8:17 ` remove ->writepage in ntfs3 Christoph Hellwig
2022-12-30 12:03 ` Konstantin Komarov
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-11-16 13:34 UTC (permalink / raw)
To: Konstantin Komarov; +Cc: ntfs3, linux-fsdevel
->writepage is a very inefficient method to write back data, and only
used through write_cache_pages or a a fallback when no ->migrate_folio
method is present.
Set ->migrate_folio to the generic buffer_head based helper, and remove
the ->writepage implementation.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/ntfs3/inode.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 7a869e2a98620..65035e3e34b15 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -826,26 +826,6 @@ int ntfs_set_size(struct inode *inode, u64 new_size)
return err;
}
-static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
-{
- struct address_space *mapping = page->mapping;
- struct inode *inode = mapping->host;
- struct ntfs_inode *ni = ntfs_i(inode);
- int err;
-
- if (is_resident(ni)) {
- ni_lock(ni);
- err = attr_data_write_resident(ni, page);
- ni_unlock(ni);
- if (err != E_NTFS_NONRESIDENT) {
- unlock_page(page);
- return err;
- }
- }
-
- return block_write_full_page(page, ntfs_get_block, wbc);
-}
-
static int ntfs_resident_writepage(struct page *page,
struct writeback_control *wbc, void *data)
{
@@ -1946,13 +1926,13 @@ const struct inode_operations ntfs_link_inode_operations = {
const struct address_space_operations ntfs_aops = {
.read_folio = ntfs_read_folio,
.readahead = ntfs_readahead,
- .writepage = ntfs_writepage,
.writepages = ntfs_writepages,
.write_begin = ntfs_write_begin,
.write_end = ntfs_write_end,
.direct_IO = ntfs_direct_IO,
.bmap = ntfs_bmap,
.dirty_folio = block_dirty_folio,
+ .migrate_folio = buffer_migrate_folio,
.invalidate_folio = block_invalidate_folio,
};
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: remove ->writepage in ntfs3
2022-11-16 13:34 remove ->writepage in ntfs3 Christoph Hellwig
2022-11-16 13:34 ` [PATCH 1/2] ntfs3: stop using generic_writepages Christoph Hellwig
2022-11-16 13:34 ` [PATCH 2/2] ntfs3: remove ->writepage Christoph Hellwig
@ 2022-12-04 8:17 ` Christoph Hellwig
2022-12-30 12:03 ` Konstantin Komarov
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-12-04 8:17 UTC (permalink / raw)
To: Konstantin Komarov; +Cc: ntfs3, linux-fsdevel
On Wed, Nov 16, 2022 at 02:34:50PM +0100, Christoph Hellwig wrote:
> Hi Konstantin,
>
> this small series removes the deprecated ->writepage method from ntfs3.
> I don't have a ntfs test setup so this is untested and should be handled
> with care.
Did you get a chance to look into this?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: remove ->writepage in ntfs3
2022-11-16 13:34 remove ->writepage in ntfs3 Christoph Hellwig
` (2 preceding siblings ...)
2022-12-04 8:17 ` remove ->writepage in ntfs3 Christoph Hellwig
@ 2022-12-30 12:03 ` Konstantin Komarov
3 siblings, 0 replies; 5+ messages in thread
From: Konstantin Komarov @ 2022-12-30 12:03 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: ntfs3, linux-fsdevel
On 16.11.2022 17:34, Christoph Hellwig wrote:
> Hi Konstantin,
>
> this small series removes the deprecated ->writepage method from ntfs3.
> I don't have a ntfs test setup so this is untested and should be handled
> with care.
>
> Diffstat:
> inode.c | 33 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 18 deletions(-)
Hello Christoph,
Sorry for the delay. We have taken your patches for testing.
We will be back with an answer as soon as possible.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-30 12:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-16 13:34 remove ->writepage in ntfs3 Christoph Hellwig
2022-11-16 13:34 ` [PATCH 1/2] ntfs3: stop using generic_writepages Christoph Hellwig
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
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).