qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/6] libqblock APIs


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 1/6] libqblock APIs
Date: Tue, 04 Sep 2012 09:29:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

Il 04/09/2012 09:05, Wenchao Xia ha scritto:
>> That said, QEMU's internal bdrv_is_allocated function does have one not
>> entirely appealing property: the block at start + *pnum might have the
>> same state as the block at start + *pnum - 1, even if *pnum < length.
>> We may want to work around this in libqblock, but we could also simply
>> document it.
>>
>> Paolo
>>
> int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,
>                       int nb_sectors,int *pnum)
> will the issue happen when nb_sectors > *pnum? if so it seems a bug,
> because caller is asking a range of sectors's allocation status, and
> *pnum did not reflect the real status.

Actually it does.

bdrv_is_allocated says it didn't find out anything about sector start +
*pnum and later.

>>> Either way, I think you are supplying too
>>> many parameters for how I envision checking for allocated sectors.
>>
>   yes, it is a bit confusing, how about:
> 
> int qb_check_allocate_status(struct QBroker *broker,
>                              struct QBlockState *qbs,
>                              offset sector_start,
>                              size_t sector_number,
>                              size_t *pnum,
>                              int *status)
> user input sector_start and sector_number to ask check it in this range,
> following parameter receive the status, return indicate exception.

That's ok too.

But do not use size_t for sectors.  Testing, or reading, or writing 2 TB
with a single call is more than enough.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]