xfs: don't reserve blocks for right shift transactions
authorBrian Foster <bfoster@redhat.com>
Wed, 15 Feb 2017 18:18:10 +0000 (10:18 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 17 Feb 2017 01:20:13 +0000 (17:20 -0800)
commit48af96ab92bc68fb645068b978ce36df2379e076
treefb85461befd4a09fc01c4d00fe1d9e3384dde502
parent353fe445f5efd58dfec6e06bf4747a9c28374adc
xfs: don't reserve blocks for right shift transactions

The block reservation for the transaction allocated in
xfs_shift_file_space() is an artifact of the original collapse range
support. It exists to handle the case where a collapse range occurs,
the initial extent is left shifted into a location that forms a
contiguous boundary with the previous extent and thus the extents
are merged. This code was subsequently refactored and reused for
insert range (right shift) support.

If an insert range occurs under low free space conditions, the
extent at the starting offset is split before the first shift
transaction is allocated. If the block reservation fails, this
leaves separate, but contiguous extents around in the inode. While
not a fatal problem, this is unexpected and will flag a warning on
subsequent insert range operations on the inode. This problem has
been reproduce intermittently by generic/270 running against a
ramdisk device.

Since right shift does not create new extent boundaries in the
inode, a block reservation for extent merge is unnecessary. Update
xfs_shift_file_space() to conditionally reserve fs blocks for left
shift transactions only. This avoids the warning reproduced by
generic/270.

Reported-by: Ross Zwisler <ross.zwisler@linux.intel.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/xfs_bmap_util.c