aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2013-10-08 14:43:14 +0200
committerKevin Wolf <kwolf@redhat.com>2013-10-11 16:49:59 +0200
commit92bc50a5ad7fbc9a0bd17240eaea5027a100ca79 (patch)
tree105ca03529f39cc6d27eb0a89c36e498c61890f2 /block.c
parent88fb15351284868b70fa1d5b101e809057fcc5aa (diff)
block/get_block_status: avoid redundant callouts on raw devices
if a raw device like an iscsi target or host device is used the current implementation makes a second call out to get the block status of bs->file. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block.c b/block.c
index 43acaadbce..d86efad867 100644
--- a/block.c
+++ b/block.c
@@ -3147,6 +3147,12 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
return ret;
}
+ if (ret & BDRV_BLOCK_RAW) {
+ assert(ret & BDRV_BLOCK_OFFSET_VALID);
+ return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS,
+ *pnum, pnum);
+ }
+
if (!(ret & BDRV_BLOCK_DATA)) {
if (bdrv_has_zero_init(bs)) {
ret |= BDRV_BLOCK_ZERO;