[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 16/17] block: add default get_block_status implem
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v2 16/17] block: add default get_block_status implementation for protocols |
Date: |
Tue, 16 Jul 2013 18:29:27 +0200 |
Protocols return raw data, so you can assume the offsets to pass
through unchanged.
Signed-off-by: Paolo Bonzini <address@hidden>
---
block.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 0c867b8..557ce29 100644
--- a/block.c
+++ b/block.c
@@ -2991,7 +2991,11 @@ static int64_t coroutine_fn
bdrv_co_get_block_status(BlockDriverState *bs,
if (!bs->drv->bdrv_co_get_block_status) {
*pnum = nb_sectors;
- return BDRV_BLOCK_DATA;
+ ret = BDRV_BLOCK_DATA;
+ if (bs->drv->protocol_name) {
+ ret |= BDRV_BLOCK_OFFSET_VALID | (sector_num * BDRV_SECTOR_SIZE);
+ }
+ return ret;
}
ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);
--
1.8.3.1
- Re: [Qemu-devel] [PATCH v2 13/17] block: use bdrv_has_zero_init to return BDRV_BLOCK_ZERO, (continued)
- [Qemu-devel] [PATCH v2 12/17] qemu-img: add a "map" subcommand, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 14/17] raw-posix: return get_block_status data and flags, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 15/17] raw-posix: detect XFS unwritten extents, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 16/17] block: add default get_block_status implementation for protocols,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v2 17/17] block: look for zero blocks in bs->file, Paolo Bonzini, 2013/07/16
- Re: [Qemu-devel] [PATCH v2 17/17] block: look for zero blocks in bs->file, Eric Blake, 2013/07/19
- [Qemu-devel] [PATCH v2 06/17] block: expect errors from bdrv_co_is_allocated, Paolo Bonzini, 2013/07/16
- [Qemu-devel] [PATCH v2 07/17] qemu-img: always probe the input image for allocated sectors, Paolo Bonzini, 2013/07/16