diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-07-26 11:28:30 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-07-30 15:35:37 +0200 |
commit | 34fa110e424e9a6a9b7e0274c3d4bfee766eb7ed (patch) | |
tree | 9945980f1dc926e3eded753cd982e2778055fd38 /COPYING | |
parent | 52ebcb268273de217510bc9ed688c23894ae32a2 (diff) | |
download | qemu-34fa110e424e9a6a9b7e0274c3d4bfee766eb7ed.zip qemu-34fa110e424e9a6a9b7e0274c3d4bfee766eb7ed.tar.gz qemu-34fa110e424e9a6a9b7e0274c3d4bfee766eb7ed.tar.bz2 |
file-posix: Fix write_zeroes with unmap on block devices
The BLKDISCARD ioctl doesn't guarantee that the discarded blocks read as
all-zero afterwards, so don't try to abuse it for zero writing. We try
to only use this if BLKDISCARDZEROES tells us that it is safe, but this
is unreliable on older kernels and a constant 0 in newer kernels. In
other words, this code path is never actually used with newer kernels,
so we don't even try to unmap while writing zeros.
This patch removes the abuse of discard for writing zeroes from
file-posix and instead adds a new function that uses interfaces that are
actually meant to deallocate and zero out at the same time. Only if
those fail, it falls back to zeroing out without unmap. We never fall
back to a discard operation any more that may or may not result in
zeros.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions