block: round up file size to nearest sector

Enterprise / Virtualization / QEMU - Hu Tao [cn.fujitsu.com] - 12 September 2014 08:43 UTC

Currently the file size requested by user is rounded down to nearest sector, causing the actual file size could be a bit less than the size user requested. Since some formats (like qcow2) record virtual disk size in bytes, this can make the last few bytes cannot be accessed.

This patch fixes it by rounding up file size to nearest sector so that the actual file size is no less than the requested file size.

c2eb918 block: round up file size to nearest sector
block/archipelago.c | 3 +-
block/cow.c | 3 +-
block/gluster.c | 4 +--
block/iscsi.c | 4 +--
block/nfs.c | 3 +-
block/qcow.c | 3 +-
block/qcow2.c | 3 +-
block/qed.c | 3 +-
block/raw-posix.c | 8 +++---
block/raw-win32.c | 4 +--
block/rbd.c | 3 +-
block/sheepdog.c | 3 +-
block/ssh.c | 3 +-
block/vdi.c | 3 +-
block/vhdx.c | 3 +-
block/vmdk.c | 3 +-
block/vpc.c | 3 +-
tests/qemu-iotests/104 | 57 ++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/104.out | 12 ++++++++
tests/qemu-iotests/common.filter | 21 ++++++++++++++
tests/qemu-iotests/group | 1 +
21 files changed, 127 insertions(+), 23 deletions(-)

Upstream: git.qemu.org


  • Share