From: Christoph Hellwig Date: Thu, 16 Jan 2020 22:12:49 +0000 (-0500) Subject: xfs: use a struct iomap in xfs_writepage_ctx X-Git-Tag: v5.5.0-rc0~106 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75f533e65659d7fe279b663f56c2e8a26035bef5;p=thirdparty%2Fxfsprogs-dev.git xfs: use a struct iomap in xfs_writepage_ctx 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 Reviewed-by: Dave Chinner Reviewed-by: Carlos Maiolino Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/include/libxfs.h b/include/libxfs.h index 85ced52a2..7ffef9e1e 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -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" /* diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index d944efc0c..3a0282f17 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -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" /* diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 96f7945bb..f4779c260 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -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) diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h index e2798c6f3..14d25e0b7 100644 --- a/libxfs/xfs_bmap.h +++ b/libxfs/xfs_bmap.h @@ -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,