[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv4] block/get_block_status: avoid redundant callo
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCHv4] block/get_block_status: avoid redundant callouts on raw devices |
Date: |
Wed, 02 Oct 2013 17:13:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
Il 02/10/2013 17:06, Stefan Hajnoczi ha scritto:
> Sorry I didn't review this earlier but this flag looks hacky and I'm not
> confident about merging the patch yet.
>
> The patch makes me wonder if the raw_bsd driver should avoid calling
> bs->file itself:
>
> return BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID |
> (sector_num << BDRV_SECTOR_BITS);
>
> Let block.c:bdrv_co_get_block_status() call down into bs->file.
>
> The problem is then the protocol cannot report unallocated sectors with
> this approach.
>
> I think we want to preserve bs' offset while taking the other flags from
> bs->file (DATA, ZERO).
This would cause other changes. For example, a qcow2 with full metadata
preallocation (i.e. all L2 tables are there but it points to holes)
would not return DATA anymore. I think this is wrong, and especially a
change from the old is_allocated API.
However, a variant on this idea could be to return
BDRV_BLOCK_RAW | BDRV_BLOCK_OFFSET_VALID |
(sector_num << BDRV_SECTOR_BITS);
and then BDRV_BLOCK_RAW would mean "take DATA and ZERO from bs->file".
Paolo
> Peter, Paolo: What do you think of this approach?