aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2010-04-19 16:56:41 +0100
committerKevin Wolf <kwolf@redhat.com>2010-05-03 10:07:32 +0200
commit51762288b41f59d027073c404a29256fc4d4540e (patch)
treebd81fbd9db389001c8715a1f5a1fb3bc54574c83 /qemu-img.c
parent4899d10d142e97eea8f64141a3507b2ee1a64f52 (diff)
downloadqemu-51762288b41f59d027073c404a29256fc4d4540e.zip
qemu-51762288b41f59d027073c404a29256fc4d4540e.tar.gz
qemu-51762288b41f59d027073c404a29256fc4d4540e.tar.bz2
block: Cache total_sectors to reduce bdrv_getlength calls
The BlockDriver bdrv_getlength function is called from the I/O code path when checking that the request falls within the device. Unfortunately this involves an lseek system call in the raw protocol; every read or write request will incur this lseek cost. Jan Kiszka <jan.kiszka@siemens.com> identified this issue and its latency overhead. This patch caches device length in the existing total_sectors variable so lseek calls can be avoided for fixed size devices. Growable devices fall back to the full bdrv_getlength code path because I have not added logic to detect extending the size of the device in a write. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
0 files changed, 0 insertions, 0 deletions