]> git.proxmox.com Git - mirror_qemu.git/commit - block/linux-aio.c
linux-aio: Allow reads beyond the end of growable images
authorKevin Wolf <kwolf@redhat.com>
Thu, 13 Oct 2011 13:42:52 +0000 (15:42 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 14 Oct 2011 08:29:13 +0000 (10:29 +0200)
commitb161e2e4b32ac8fb9e6a891eba3da0b825b5d046
tree6fce6aa203716a01110062b1563fc82074a2bb66
parent1a6e115b19b0d3831d63bbacb843722070e6674c
linux-aio: Allow reads beyond the end of growable images

This is the linux-aio version of commits 22afa7b5 (raw-posix, synchronous) and
ba1d1afd (posix-aio-compat). Reads now produce zeros after the end of file
instead of failing or resulting in short reads, making linux-aio compatible
with the behaviour of synchronous raw-posix requests and posix-aio-compat.

The problem can be reproduced like this:

dd if=/dev/zero of=/tmp/test.raw bs=1 count=1234
./qemu-io -k -n -g -c 'read -p 1024 512' /tmp/test.raw

Previously, the result of this was 'read failed: Invalid argument', now the
read completes successfully.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
linux-aio.c