]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: store in-progress CoW allocations in the refcount btree
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Oct 2016 01:41:50 +0000 (12:41 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 25 Oct 2016 01:41:50 +0000 (12:41 +1100)
commit10e6550346b5416413ca0c975578a018a06bcc8f
tree9ac6e8da65df3a5b318cfd4c5249be26e8eb4473
parentd35205bac9f922c9548c5432240319d654ab7cfa
xfs: store in-progress CoW allocations in the refcount btree

Source kernel commit: 174edb0e46e520230791a1a894397b7c824cefc4

Due to the way the CoW algorithm in XFS works, there's an interval
during which blocks allocated to handle a CoW can be lost -- if the FS
goes down after the blocks are allocated but before the block
remapping takes place.  This is exacerbated by the cowextsz hint --
allocated reservations can sit around for a while, waiting to get
used.

Since the refcount btree doesn't normally store records with refcount
of 1, we can use it to record these in-progress extents.  In-progress
blocks cannot be shared because they're not user-visible, so there
shouldn't be any conflicts with other programs.  This is a better
solution than holding EFIs during writeback because (a) EFIs can't be
relogged currently, (b) even if they could, EFIs are bound by
available log space, which puts an unnecessary upper bound on how much
CoW we can have in flight, and (c) we already have a mechanism to
track blocks.

At mount time, read the refcount records and free anything we find
with a refcount of 1 because those were in-progress when the FS went
down.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
include/xfs_trace.h
libxfs/xfs_bmap.c
libxfs/xfs_format.h
libxfs/xfs_refcount.c
libxfs/xfs_refcount.h