]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: try other AGs to allocate a BMBT block
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Oct 2016 01:43:48 +0000 (12:43 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 25 Oct 2016 01:43:48 +0000 (12:43 +1100)
commit68d06dce06465b4958990abc14ec7ab06d1112e5
tree25e746b6c71ce48b0790234114cb8d3aefeed098
parent02cc8b2a1b04b4e1e7cc0bdc088d42224c6b87fc
xfs: try other AGs to allocate a BMBT block

Source kernel commit: 90e2056d76adc7894a019f5289d259de58065e13

Prior to the introduction of reflink, allocating a block and mapping
it into a file was performed in a single transaction with a single
block reservation, and the allocator was supposed to find enough
blocks to allocate the extent and any BMBT blocks that might be
necessary (unless we're low on space).

However, due to the way copy on write works, allocation and mapping
have been split into two transactions, which means that we must be
able to handle the case where we allocate an extent for CoW but that
AG runs out of free space before the blocks can be mapped into a file,
and the mapping requires a new BMBT block.  When this happens, look in
one of the other AGs for a BMBT block instead of taking the FS down.

The same applies to the functions that convert a data fork to extents
and later btree format.

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