]> asedeno.scripts.mit.edu Git - linux.git/commit
xfs: split indlen reservations fairly when under reserved
authorBrian Foster <bfoster@redhat.com>
Tue, 14 Feb 2017 06:48:30 +0000 (22:48 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 17 Feb 2017 01:20:12 +0000 (17:20 -0800)
commit75d65361cf3c0dae2af970c305e19c727b28a510
tree9966e057017ba46f31d7ff653934290b1eb62e13
parent0e339ef8556d9e567aa7925f8892c263d79430d9
xfs: split indlen reservations fairly when under reserved

Certain workoads that punch holes into speculative preallocation can
cause delalloc indirect reservation splits when the delalloc extent is
split in two. If further splits occur, an already short-handed extent
can be split into two in a manner that leaves zero indirect blocks for
one of the two new extents. This occurs because the shortage is large
enough that the xfs_bmap_split_indlen() algorithm completely drains the
requested indlen of one of the extents before it honors the existing
reservation.

This ultimately results in a warning from xfs_bmap_del_extent(). This
has been observed during file copies of large, sparse files using 'cp
--sparse=always.'

To avoid this problem, update xfs_bmap_split_indlen() to explicitly
apply the reservation shortage fairly between both extents. This smooths
out the overall indlen shortage and defers the situation where we end up
with a delalloc extent with zero indlen reservation to extreme
circumstances.

Reported-by: Patrick Dung <mpatdung@gmail.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_bmap.c