]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: remove xfs_page_mkwrite_iomap_ops
authorChristoph Hellwig <hch@lst.de>
Tue, 29 Oct 2024 15:12:00 +0000 (16:12 +0100)
committerCarlos Maiolino <cem@kernel.org>
Tue, 5 Nov 2024 12:52:57 +0000 (13:52 +0100)
Shared the regular buffered write iomap_ops with the page fault path
and just check for the IOMAP_FAULT flag to skip delalloc punching.

This keeps the delalloc punching checks in one place, and will make it
easier to convert iomap to an iter model where the begin and end
handlers are merged into a single callback.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_file.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_iomap.h

index 7464d874e766364409bb5050c751dba1b98cce5d..c6de6b865ef11cc047e927fc2d978f6a256dd425 100644 (file)
@@ -1474,7 +1474,7 @@ xfs_write_fault(
        if (IS_DAX(inode))
                ret = xfs_dax_fault_locked(vmf, order, true);
        else
-               ret = iomap_page_mkwrite(vmf, &xfs_page_mkwrite_iomap_ops);
+               ret = iomap_page_mkwrite(vmf, &xfs_buffered_write_iomap_ops);
        xfs_iunlock(ip, lock_mode);
 
        sb_end_pagefault(inode->i_sb);
index 86da16f54be9d78e7d752b7a14514d8d9e8d6335..0c7a9b2000047185d3b47c61e3556ec5a8824d05 100644 (file)
@@ -1234,6 +1234,14 @@ xfs_buffered_write_iomap_end(
        if (iomap->type != IOMAP_DELALLOC || !(iomap->flags & IOMAP_F_NEW))
                return 0;
 
+       /*
+        * iomap_page_mkwrite() will never fail in a way that requires delalloc
+        * extents that it allocated to be revoked.  Hence never try to release
+        * them here.
+        */
+       if (flags & IOMAP_FAULT)
+               return 0;
+
        /* Nothing to do if we've written the entire delalloc extent */
        start_byte = iomap_last_written_block(inode, offset, written);
        end_byte = round_up(offset + length, i_blocksize(inode));
@@ -1260,15 +1268,6 @@ const struct iomap_ops xfs_buffered_write_iomap_ops = {
        .iomap_end              = xfs_buffered_write_iomap_end,
 };
 
-/*
- * iomap_page_mkwrite() will never fail in a way that requires delalloc extents
- * that it allocated to be revoked. Hence we do not need an .iomap_end method
- * for this operation.
- */
-const struct iomap_ops xfs_page_mkwrite_iomap_ops = {
-       .iomap_begin            = xfs_buffered_write_iomap_begin,
-};
-
 static int
 xfs_read_iomap_begin(
        struct inode            *inode,
index 4da13440bae9bd7e67f5044b8bfc3544d57e8be9..8347268af7277a0e9755bfaad350fb03464ce2db 100644 (file)
@@ -48,7 +48,6 @@ xfs_aligned_fsb_count(
 }
 
 extern const struct iomap_ops xfs_buffered_write_iomap_ops;
-extern const struct iomap_ops xfs_page_mkwrite_iomap_ops;
 extern const struct iomap_ops xfs_direct_write_iomap_ops;
 extern const struct iomap_ops xfs_read_iomap_ops;
 extern const struct iomap_ops xfs_seek_iomap_ops;