On 8/23/19 9:03 AM, Max Reitz wrote:
> This patch removes xfs_write_zeroes() and xfs_discard(). Both functions
> have been added just before the same feature was present through
> fallocate():
>
> - fallocate() has supported PUNCH_HOLE for XFS since Linux 2.6.38 (March
> 2011); xfs_discard() was added in December 2010.
>
> - fallocate() has supported ZERO_RANGE for XFS since Linux 3.15 (June
> 2014); xfs_write_zeroes() was added in November 2013.
>
> Nowadays, all systems that qemu runs on should support both fallocate()
> features (RHEL 7's kernel does).
>
> xfsctl() is still useful for getting the request alignment for O_DIRECT,
> so this patch does not remove our dependency on it completely.
>
> Note that xfs_write_zeroes() had a bug: It calls ftruncate() when the
> file is shorter than the specified range (because ZERO_RANGE does not
> increase the file length). ftruncate() may yield and then discard data
> that parallel write requests have written past the EOF in the meantime.
> Dropping the function altogether fixes the bug.
>
And I assume getting rid of discard is just then simply convenient, so
why not.
> Suggested-by: Paolo Bonzini <pbonz...@redhat.com>
> Fixes: 50ba5b2d994853b38fed10e0841b119da0f8b8e5
> Reported-by: Lukáš Doktor <ldok...@redhat.com>
> Cc: qemu-sta...@nongnu.org
> Signed-off-by: Max Reitz <mre...@redhat.com>
Tested-by: John Snow <js...@redhat.com>
Reviewed-by: John Snow <js...@redhat.com>