summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-10-24 18:25:46 +0900
committerAndrew Morton <akpm@linux-foundation.org>2024-11-05 17:12:40 -0800
commit013a07052a1a02d6d8bebf84ad3a8cb483292da7 (patch)
tree4ed52800d38603976c220b423f035f88d07c4f31
parentb18d78dec38e0ccd06e968396388eadea1da1c4e (diff)
nilfs2: convert metadata aops from writepage to writepages
By implementing ->writepages instead of ->writepage, we remove a layer of indirect function calls from the writeback path and the last use of struct page in nilfs2. [konishi.ryusuke@gmail.com: fixed panic by using buffer_migrate_folio_norefs] Link: https://lkml.kernel.org/r/20241002150036.1339475-5-willy@infradead.org Link: https://lkml.kernel.org/r/20241024092602.13395-13-konishi.ryusuke@gmail.com Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--fs/nilfs2/mdt.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index a4c1e00aaaac..432181cfb0b5 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -399,10 +399,9 @@ int nilfs_mdt_fetch_dirty(struct inode *inode)
return test_bit(NILFS_I_DIRTY, &ii->i_state);
}
-static int
-nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
+static int nilfs_mdt_write_folio(struct folio *folio,
+ struct writeback_control *wbc)
{
- struct folio *folio = page_folio(page);
struct inode *inode = folio->mapping->host;
struct super_block *sb;
int err = 0;
@@ -435,11 +434,23 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
return err;
}
+static int nilfs_mdt_writeback(struct address_space *mapping,
+ struct writeback_control *wbc)
+{
+ struct folio *folio = NULL;
+ int error;
+
+ while ((folio = writeback_iter(mapping, wbc, folio, &error)))
+ error = nilfs_mdt_write_folio(folio, wbc);
+
+ return error;
+}
static const struct address_space_operations def_mdt_aops = {
.dirty_folio = block_dirty_folio,
.invalidate_folio = block_invalidate_folio,
- .writepage = nilfs_mdt_write_page,
+ .writepages = nilfs_mdt_writeback,
+ .migrate_folio = buffer_migrate_folio_norefs,
};
static const struct inode_operations def_mdt_iops;