]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: go straight to real allocations for direct I/O COW writes
authorChristoph Hellwig <hch@lst.de>
Tue, 4 Apr 2017 20:37:44 +0000 (15:37 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 4 Apr 2017 20:37:44 +0000 (15:37 -0500)
Source kernel commit: a14234c72bf41ac96bc8c98e96e2c84b6d4bd4f2

When we allocate COW fork blocks for direct I/O writes we currently first
create a delayed allocation, and then convert it to a real allocation
once we've got the delayed one.

As there is no good reason for that this patch instead makes use call
xfs_bmapi_write from the COW allocation path.  The only interesting bits
are a few tweaks the low-level allocator to allow for this, most notably
the need to remove the call to xfs_bmap_extsize_align for the cowextsize
in xfs_bmap_btalloc - for the existing convert case it's a no-op, but
for the direct allocation case it would blow up our block reservation
way beyond what we reserved for the transaction.

Signed-off-by: Christoph Hellwig <hch@lst.de>
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>
libxfs/xfs_bmap.c

index c0d1e8dd270787a45589e0298fc2bef1bf606829..a21a1ebd976c65881e205bb9fb449febd55e942a 100644 (file)
@@ -2886,13 +2886,14 @@ xfs_bmap_add_extent_hole_real(
        ASSERT(!isnullstartblock(new->br_startblock));
        ASSERT(!bma->cur ||
               !(bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL));
-       ASSERT(whichfork != XFS_COW_FORK);
 
        XFS_STATS_INC(mp, xs_add_exlist);
 
        state = 0;
        if (whichfork == XFS_ATTR_FORK)
                state |= BMAP_ATTRFORK;
+       if (whichfork == XFS_COW_FORK)
+               state |= BMAP_COWFORK;
 
        /*
         * Check and set flags if this segment has a left neighbor.