[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 16/17] block: add default get_block_status imple
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 16/17] block: add default get_block_status implementation for protocols |
Date: |
Tue, 16 Jul 2013 11:37:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 |
Il 16/07/2013 09:54, Peter Lieven ha scritto:
> On 16.07.2013 09:19, Paolo Bonzini wrote:
>> Il 16/07/2013 08:47, Peter Lieven ha scritto:
>>>> @@ -2977,7 +2977,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);
>>> I am curious if this is right. Doesn't this mean we say that at offset
>>> sector_num * BDRV_SECTOR_SIZE are nb_sectors of linear data? This is
>>> something we do not know for sure.
>> Only for protocols. In this case, we do know, or format=raw wouldn't
>> work. This is not propagated up to the actual BDS for the image, except
>> for format=raw.
> If bs->drv->protocol_name is only != NULL if format=raw, I am
> fine with this.
No, bs->drv->protocol_name is only != NULL if it is a protocol (like
file or iscsi) rather than a format (like raw or qcow2). :)
But the user will never call bdrv_co_get_block_status on a protocol
(bs->file, roughly), only on a format (bs); and this information is only
passed from bs->file to bs for format=raw. Other formats compute the
offsets themselves.
Paolo
- [Qemu-devel] [PATCH 11/17] block: return get_block_status data and flags for formats, (continued)
- [Qemu-devel] [PATCH 11/17] block: return get_block_status data and flags for formats, Paolo Bonzini, 2013/07/03
- [Qemu-devel] [PATCH 14/17] raw-posix: return get_block_status data and flags, Paolo Bonzini, 2013/07/03
- [Qemu-devel] [PATCH 13/17] block: use bdrv_has_zero_init to return BDRV_BLOCK_ZERO, Paolo Bonzini, 2013/07/03
- [Qemu-devel] [PATCH 15/17] raw-posix: detect XFS unwritten extents, Paolo Bonzini, 2013/07/03
- [Qemu-devel] [PATCH 16/17] block: add default get_block_status implementation for protocols, Paolo Bonzini, 2013/07/03
[Qemu-devel] [PATCH 17/17] block: look for zero blocks in bs->file, Paolo Bonzini, 2013/07/03
Re: [Qemu-devel] [PATCH 00/17] Add qemu-img subcommand to dump file metadata, Stefan Hajnoczi, 2013/07/15