aboutsummaryrefslogtreecommitdiff
path: root/block/io.c
diff options
context:
space:
mode:
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>2019-08-27 16:52:53 +0300
committerEric Blake <eblake@redhat.com>2019-09-05 16:01:31 -0500
commit294682cc3a7c5b3d1b2d45b686e2d8523750ce64 (patch)
tree419b4d6946021ffcd5c8bb3e02b8d4392527faf8 /block/io.c
parent5de47735c79a030edc3e6258ab5476b630c61765 (diff)
downloadqemu-294682cc3a7c5b3d1b2d45b686e2d8523750ce64.zip
qemu-294682cc3a7c5b3d1b2d45b686e2d8523750ce64.tar.gz
qemu-294682cc3a7c5b3d1b2d45b686e2d8523750ce64.tar.bz2
block: workaround for unaligned byte range in fallocate()
Revert the commit 118f99442d 'block/io.c: fix for the allocation failure' and use better error handling for file systems that do not support fallocate() for an unaligned byte range. Allow falling back to pwrite in case fallocate() returns EINVAL. Suggested-by: Kevin Wolf <kwolf@redhat.com> Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Denis V. Lunev <den@openvz.org> Message-Id: <1566913973-15490-1-git-send-email-andrey.shinkevich@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/io.c b/block/io.c
index 0fa10831..16a598f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1746,7 +1746,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,
assert(!bs->supported_zero_flags);
}
- if (ret < 0 && !(flags & BDRV_REQ_NO_FALLBACK)) {
+ if (ret == -ENOTSUP && !(flags & BDRV_REQ_NO_FALLBACK)) {
/* Fall back to bounce buffer if write zeroes is unsupported */
BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE;