]> www.infradead.org Git - users/hch/misc.git/commitdiff
9p: don't opencode filemap_fdatawrite_range in v9fs_mmap_vm_close
authorChristoph Hellwig <hch@lst.de>
Thu, 25 Sep 2025 11:10:11 +0000 (13:10 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 23 Oct 2025 06:47:24 +0000 (08:47 +0200)
Use filemap_fdatawrite_range instead of opencoding the logic using
filemap_fdatawrite_wbc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
fs/9p/vfs_file.c

index eb0b083da269b438107939838d1da20f3523eaf9..612a230bc012710cdc02ce039f897db197f4ed01 100644 (file)
@@ -483,24 +483,15 @@ v9fs_vm_page_mkwrite(struct vm_fault *vmf)
 
 static void v9fs_mmap_vm_close(struct vm_area_struct *vma)
 {
-       struct inode *inode;
-
-       struct writeback_control wbc = {
-               .nr_to_write = LONG_MAX,
-               .sync_mode = WB_SYNC_ALL,
-               .range_start = (loff_t)vma->vm_pgoff * PAGE_SIZE,
-                /* absolute end, byte at end included */
-               .range_end = (loff_t)vma->vm_pgoff * PAGE_SIZE +
-                       (vma->vm_end - vma->vm_start - 1),
-       };
-
        if (!(vma->vm_flags & VM_SHARED))
                return;
 
        p9_debug(P9_DEBUG_VFS, "9p VMA close, %p, flushing", vma);
 
-       inode = file_inode(vma->vm_file);
-       filemap_fdatawrite_wbc(inode->i_mapping, &wbc);
+       filemap_fdatawrite_range(file_inode(vma->vm_file)->i_mapping,
+                       (loff_t)vma->vm_pgoff * PAGE_SIZE,
+                       (loff_t)vma->vm_pgoff * PAGE_SIZE +
+                               (vma->vm_end - vma->vm_start - 1));
 }
 
 static const struct vm_operations_struct v9fs_mmap_file_vm_ops = {