Skip to content

Commit f72a675

Browse files
Christoph HellwigAnna Schumaker
authored andcommitted
nfs: use writeback_iter directly
Stop using write_cache_pages and use writeback_iter directly. This removes an indirect call per written folio and makes the code easier to follow. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 66a4981 commit f72a675

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

fs/nfs/write.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -694,16 +694,6 @@ static int nfs_writepage_locked(struct folio *folio,
694694
return err;
695695
}
696696

697-
static int nfs_writepages_callback(struct folio *folio,
698-
struct writeback_control *wbc, void *data)
699-
{
700-
int ret;
701-
702-
ret = nfs_do_writepage(folio, wbc, data);
703-
folio_unlock(folio);
704-
return ret;
705-
}
706-
707697
static void nfs_io_completion_commit(void *inode)
708698
{
709699
nfs_commit_inode(inode, 0);
@@ -739,11 +729,15 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
739729
}
740730

741731
do {
732+
struct folio *folio = NULL;
733+
742734
nfs_pageio_init_write(&pgio, inode, priority, false,
743735
&nfs_async_write_completion_ops);
744736
pgio.pg_io_completion = ioc;
745-
err = write_cache_pages(mapping, wbc, nfs_writepages_callback,
746-
&pgio);
737+
while ((folio = writeback_iter(mapping, wbc, folio, &err))) {
738+
err = nfs_do_writepage(folio, wbc, &pgio);
739+
folio_unlock(folio);
740+
}
747741
pgio.pg_error = 0;
748742
nfs_pageio_complete(&pgio);
749743
if (err == -EAGAIN && mntflags & NFS_MOUNT_SOFTERR)

0 commit comments

Comments
 (0)