]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: don't opencode filemap_fdatawrite_range in filemap_invalidate_inode
authorChristoph Hellwig <hch@lst.de>
Fri, 24 Oct 2025 08:04:12 +0000 (10:04 +0200)
committerChristian Brauner <brauner@kernel.org>
Wed, 29 Oct 2025 14:50:40 +0000 (15:50 +0100)
Use filemap_fdatawrite_range instead of opencoding the logic using
filemap_fdatawrite_wbc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20251024080431.324236-2-hch@lst.de
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
mm/filemap.c

index 13f0259d993c9c0431e51b22a42fe0f644a4546a..99d6919af60da09bc5e026be6378047cd7c4c857 100644 (file)
@@ -4457,16 +4457,8 @@ int filemap_invalidate_inode(struct inode *inode, bool flush,
        unmap_mapping_pages(mapping, first, nr, false);
 
        /* Write back the data if we're asked to. */
-       if (flush) {
-               struct writeback_control wbc = {
-                       .sync_mode      = WB_SYNC_ALL,
-                       .nr_to_write    = LONG_MAX,
-                       .range_start    = start,
-                       .range_end      = end,
-               };
-
-               filemap_fdatawrite_wbc(mapping, &wbc);
-       }
+       if (flush)
+               filemap_fdatawrite_range(mapping, start, end);
 
        /* Wait for writeback to complete on all folios and discard. */
        invalidate_inode_pages2_range(mapping, start / PAGE_SIZE, end / PAGE_SIZE);