]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: use a struct iomap in xfs_writepage_ctx
authorChristoph Hellwig <hch@lst.de>
Thu, 16 Jan 2020 22:12:49 +0000 (17:12 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 16 Jan 2020 22:12:49 +0000 (17:12 -0500)
Source kernel commit: 4e087a3b313cc664057279b1e40372fc97e3e212

In preparation for moving the XFS writeback code to fs/iomap.c, switch
it to use struct iomap instead of the XFS-specific struct xfs_bmbt_irec.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/libxfs.h
libxfs/libxfs_priv.h
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h

index 85ced52a29767eda5396232cb20c16be5e70a766..7ffef9e1e3081386f5c4dee9b40ad6847d9ae49f 100644 (file)
@@ -34,6 +34,8 @@
 extern uint32_t crc32c_le(uint32_t crc, unsigned char const *p, size_t len);
 #define crc32c(c,p,l)  crc32c_le((c),(unsigned char const *)(p),(l))
 
+/* fake up kernel's iomap, (not) used in xfs_bmap.[ch] */
+struct iomap;
 #include "xfs_cksum.h"
 
 /*
index d944efc0c4536a1504b5aa262c9e8dd3f4fffdf8..3a0282f17eccef20dce5b067f48cf515fb3792d3 100644 (file)
@@ -62,9 +62,16 @@ extern kmem_zone_t *xfs_buf_zone;
 extern kmem_zone_t *xfs_inode_zone;
 extern kmem_zone_t *xfs_trans_zone;
 
+/* fake up iomap, (not) used in xfs_bmap.[ch] */
+#define IOMAP_F_SHARED                 0x04
+#define xfs_bmbt_to_iomap(a, b, c, d)  ((void) 0)
+
 /* CRC stuff, buffer API dependent on it */
 #define crc32c(c,p,l)  crc32c_le((c),(unsigned char const *)(p),(l))
 
+/* fake up kernel's iomap, (not) used in xfs_bmap.[ch] */
+struct iomap;
+
 #include "xfs_cksum.h"
 
 /*
index 96f7945bb8c0bfa900d3b8129fdccf06f5720307..f4779c260098d6014378a5d6032b83af8d65e1af 100644 (file)
@@ -4449,16 +4449,21 @@ int
 xfs_bmapi_convert_delalloc(
        struct xfs_inode        *ip,
        int                     whichfork,
-       xfs_fileoff_t           offset_fsb,
-       struct xfs_bmbt_irec    *imap,
+       xfs_off_t               offset,
+       struct iomap            *iomap,
        unsigned int            *seq)
 {
        struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
        struct xfs_mount        *mp = ip->i_mount;
+       xfs_fileoff_t           offset_fsb = XFS_B_TO_FSBT(mp, offset);
        struct xfs_bmalloca     bma = { NULL };
+       uint16_t                flags = 0;
        struct xfs_trans        *tp;
        int                     error;
 
+       if (whichfork == XFS_COW_FORK)
+               flags |= IOMAP_F_SHARED;
+
        /*
         * Space for the extent and indirect blocks was reserved when the
         * delalloc extent was created so there's no need to do so here.
@@ -4488,7 +4493,7 @@ xfs_bmapi_convert_delalloc(
         * the extent.  Just return the real extent at this offset.
         */
        if (!isnullstartblock(bma.got.br_startblock)) {
-               *imap = bma.got;
+               xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags);
                *seq = READ_ONCE(ifp->if_seq);
                goto out_trans_cancel;
        }
@@ -4521,7 +4526,7 @@ xfs_bmapi_convert_delalloc(
        XFS_STATS_INC(mp, xs_xstrat_quick);
 
        ASSERT(!isnullstartblock(bma.got.br_startblock));
-       *imap = bma.got;
+       xfs_bmbt_to_iomap(ip, iomap, &bma.got, flags);
        *seq = READ_ONCE(ifp->if_seq);
 
        if (whichfork == XFS_COW_FORK)
index e2798c6f3a5f350f655ec02ef6e439212d0b45d8..14d25e0b7d9c8b3968ae092fd399e775936dec4c 100644 (file)
@@ -228,8 +228,7 @@ int xfs_bmapi_reserve_delalloc(struct xfs_inode *ip, int whichfork,
                struct xfs_bmbt_irec *got, struct xfs_iext_cursor *cur,
                int eof);
 int    xfs_bmapi_convert_delalloc(struct xfs_inode *ip, int whichfork,
-               xfs_fileoff_t offset_fsb, struct xfs_bmbt_irec *imap,
-               unsigned int *seq);
+               xfs_off_t offset, struct iomap *iomap, unsigned int *seq);
 int    xfs_bmap_add_extent_unwritten_real(struct xfs_trans *tp,
                struct xfs_inode *ip, int whichfork,
                struct xfs_iext_cursor *icur, struct xfs_btree_cur **curp,