[PULL 04/26] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-10-12 Thread Kevin Wolf
read.c index b4d6b7efc3..5149fcf63a 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -146,11 +146,11 @@ cor_co_preadv_part(BlockDriverState *bs, int64_t offset, int64_t bytes, local_flags = flags; /* In case of failure, try to copy-on-read anyway */ -ret = bdr

[PATCH v3 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-09-04 Thread Paolo Bonzini
(BlockDriverState *bs, int64_t offset, int64_t bytes, local_flags = flags; /* In case of failure, try to copy-on-read anyway */ -ret = bdrv_is_allocated(bs->file->bs, offset, bytes, &n); +ret = bdrv_co_is_allocated(bs->file->bs, offset,

[PATCH v2 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-06-01 Thread Paolo Bonzini
or_co_preadv_part(BlockDriverState *bs, int64_t offset, int64_t bytes, local_flags = flags; /* In case of failure, try to copy-on-read anyway */ -ret = bdrv_is_allocated(bs->file->bs, offset, bytes, &n); +ret = bdrv_co_is_allocated(bs->file->bs, offset,

Re: [PATCH 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-04-21 Thread Eric Blake
On Wed, Apr 05, 2023 at 12:32:16PM +0200, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > block/copy-before-write.c | 2 +- > block/copy-on-read.c | 8 > block/io.c| 6 +++--- > block/mirror.c| 10 +- > block/qcow2.c |

[PATCH 4/4] block: convert more bdrv_is_allocated* and bdrv_block_status* calls to coroutine versions

2023-04-05 Thread Paolo Bonzini
s, int64_t offset, int64_t bytes, local_flags = flags; /* In case of failure, try to copy-on-read anyway */ -ret = bdrv_is_allocated(bs->file->bs, offset, bytes, &n); +ret = bdrv_co_is_allocated(bs->file->bs, offset, bytes, &n);

Re: bdrv_is_allocated

2022-02-13 Thread Philippe Mathieu-Daudé via
On 13/2/22 15:24, 沈梦姣 wrote: Hi, I’m trying to understand this function, but seems no note in the header file, could anyone help explain this function? It will be great if there is an example. Thanks in advance! thanks Cc'ing qemu-block@ list.

bdrv_is_allocated

2022-02-13 Thread 沈梦姣
Hi, I’m trying to understand this function, but seems no note in the header file, could anyone help explain this function? It will be great if there is an example. Thanks in advance! thanks

[Qemu-devel] [PULL 04/35] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-10-26 Thread Kevin Wolf
From: Eric Blake Not all callers care about which BDS owns the mapping for a given range of the file, or where the zeroes lie within that mapping. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data

[Qemu-devel] [PATCH v6 02/24] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-10-11 Thread Eric Blake
Not all callers care about which BDS owns the mapping for a given range of the file, or where the zeroes lie within that mapping. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data is consecutive from

[Qemu-devel] [PATCH v5 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-10-03 Thread Eric Blake
Not all callers care about which BDS owns the mapping for a given range of the file. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data is consecutive from the host perspective, and whether or not the

Re: [Qemu-devel] [PATCH v4 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-09-28 Thread Eric Blake
On 09/26/2017 01:31 PM, John Snow wrote: > > > On 09/13/2017 12:03 PM, Eric Blake wrote: >> Not all callers care about which BDS owns the mapping for a given >> range of the file. In particular, bdrv_is_allocated() cares more >> about finding the largest run of al

Re: [Qemu-devel] [PATCH v4 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-09-26 Thread John Snow
On 09/13/2017 12:03 PM, Eric Blake wrote: > Not all callers care about which BDS owns the mapping for a given > range of the file. In particular, bdrv_is_allocated() cares more > about finding the largest run of allocated data from the guest > perspective, whether or not

[Qemu-devel] [PATCH v4 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-09-13 Thread Eric Blake
Not all callers care about which BDS owns the mapping for a given range of the file. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data is consecutive from the host perspective. Therefore, doing

[Qemu-devel] [PATCH v3 02/23] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-13 Thread Eric Blake
Not all callers care about which BDS owns the mapping for a given range of the file. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data is consecutive from the host perspective. Therefore, doing

[Qemu-devel] [PULL 038/100] block: Make bdrv_is_allocated() byte-based

2017-07-07 Thread Kevin Wolf
hand, no rounding is needed for callers that should just continue to work with byte alignment. For the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no

Re: [Qemu-devel] [PATCH v5 00/21] make bdrv_is_allocated[_above] byte-based

2017-07-07 Thread Kevin Wolf
efore started the task of > converting our block status code to report at a byte granularity > rather than sectors. > > The overall conversion currently looks like: > part 1: bdrv_is_allocated (this series, v4 was at [1]) > part 2: dirty-bitmap (v4 is posted [2]; needs reviews)

[Qemu-devel] [PATCH v5 19/21] block: Make bdrv_is_allocated() byte-based

2017-07-07 Thread Eric Blake
needed for callers that should just continue to work with byte alignment. For the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no longer has to mess

[Qemu-devel] [PATCH v5 00/21] make bdrv_is_allocated[_above] byte-based

2017-07-07 Thread Eric Blake
at a byte granularity rather than sectors. The overall conversion currently looks like: part 1: bdrv_is_allocated (this series, v4 was at [1]) part 2: dirty-bitmap (v4 is posted [2]; needs reviews) part 3: bdrv_get_block_status (v2 is posted [3] and is mostly reviewed) part 4: upcoming series

Re: [Qemu-devel] [PATCH v4 19/21] block: Make bdrv_is_allocated() byte-based

2017-07-07 Thread Kevin Wolf
> >> } > >> > >> /* If the cluster is allocated, we don't need to take action > >> */ > >> -ret = bdrv_is_allocated(bs, sector, n, &n); > >> +ret = bdrv_is_allocated(bs, sector << B

Re: [Qemu-devel] [PATCH v4 19/21] block: Make bdrv_is_allocated() byte-based

2017-07-06 Thread Eric Blake
>> float local_progress = 0; >> >> buf_old = blk_blockalign(blk, IO_BUF_SIZE); >> @@ -3276,12 +3277,14 @@ static int img_rebase(int argc, char **argv) >> } >> >> /* If the cluster is allocated, we don'

Re: [Qemu-devel] [PATCH v4 19/21] block: Make bdrv_is_allocated() byte-based

2017-07-06 Thread Eric Blake
work with byte alignment. >> >> For the most part this patch is just the addition of scaling at the >> callers followed by inverse scaling at bdrv_is_allocated(). But >> some code, particularly bdrv_commit(), gets a lot simpler because it >> no longer has to mess with secto

Re: [Qemu-devel] [PATCH v4 19/21] block: Make bdrv_is_allocated() byte-based

2017-07-06 Thread Kevin Wolf
aligned > values, where the call might reasonbly give non-aligned results > in the future; on the other hand, no rounding is needed for callers > that should just continue to work with byte alignment. > > For the most part this patch is just the addition of scaling at the > callers

Re: [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-05 Thread Eric Blake
On 07/03/2017 05:14 PM, Eric Blake wrote: > Not all callers care about which BDS owns the mapping for a given > range of the file. In particular, bdrv_is_allocated() cares more > about finding the largest run of allocated data from the guest > perspective, whether or not that data is

[Qemu-devel] [PATCH v4 19/21] block: Make bdrv_is_allocated() byte-based

2017-07-05 Thread Eric Blake
needed for callers that should just continue to work with byte alignment. For the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no longer has to mess

[Qemu-devel] [PATCH v4 00/21] make bdrv_is_allocated[_above] byte-based

2017-07-05 Thread Eric Blake
at a byte granularity rather than sectors. The overall conversion currently looks like: part 1: bdrv_is_allocated (this series, v3 was at [1]) part 2: dirty-bitmap (v4 is posted [2]; needs reviews) part 3: bdrv_get_block_status (v2 is posted [3] and is mostly reviewed) part 4: upcoming series

Re: [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-05 Thread Fam Zheng
On Wed, 07/05 09:01, Eric Blake wrote: > On 07/05/2017 07:07 AM, Fam Zheng wrote: > >>> > >>> Sorry for bikeshedding. > >> > >> Not a problem, I also had some double-takes in writing my own code > >> trying to remember which way I wanted the 'allocation' boolean to be > >> set, so coming up with a

Re: [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-05 Thread Eric Blake
On 07/05/2017 07:07 AM, Fam Zheng wrote: >>> >>> Sorry for bikeshedding. >> >> Not a problem, I also had some double-takes in writing my own code >> trying to remember which way I wanted the 'allocation' boolean to be >> set, so coming up with a more intuitive name/default state in order to >> help

Re: [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-05 Thread Fam Zheng
e" means BDRV_BLOCK_OFFSET_VALID is wanted. > > Reasonable idea; other [shorter] names I've been toying with: > strict > mapping > precise > > any of which, if true (set true by bdrv_get_block_status), means that I > care more about BDRV_BLOCK_OFFSET_VALID and val

Re: [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-05 Thread Eric Blake
cise any of which, if true (set true by bdrv_get_block_status), means that I care more about BDRV_BLOCK_OFFSET_VALID and validity for learning host offsets, if false it means I'm okay getting a larger *pnum even if it extends over disjoint host offsets; or: fast which if true (set true b

Re: [Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-04 Thread Fam Zheng
On Mon, 07/03 17:14, Eric Blake wrote: > @@ -1717,6 +1718,10 @@ int64_t coroutine_fn > bdrv_co_get_block_status_from_backing(BlockDriverState *bs, > * Drivers not implementing the functionality are assumed to not support > * backing files, hence all their sectors are reported as allocated. >

[Qemu-devel] [PATCH v2 03/15] block: Add flag to avoid wasted work in bdrv_is_allocated()

2017-07-03 Thread Eric Blake
Not all callers care about which BDS owns the mapping for a given range of the file. In particular, bdrv_is_allocated() cares more about finding the largest run of allocated data from the guest perspective, whether or not that data is consecutive from the host perspective. Therefore, doing

Re: [Qemu-devel] [PATCH v3 18/20] block: Make bdrv_is_allocated() byte-based

2017-07-03 Thread Eric Blake
On 06/27/2017 02:24 PM, Eric Blake wrote: > We are gradually moving away from sector-based interfaces, towards > byte-based. In the common case, allocation is unlikely to ever use > values that are not naturally sector-aligned, but it is possible > that byte-based values will let us be more precis

Re: [Qemu-devel] [PATCH v3 18/20] block: Make bdrv_is_allocated() byte-based

2017-06-30 Thread Jeff Cody
l want aligned > values, where the call might reasonbly give non-aligned results > in the future; on the other hand, no rounding is needed for callers > that should just continue to work with byte alignment. > > For the most part this patch is just the addition of scaling at the >

Re: [Qemu-devel] [PATCH v3 18/20] block: Make bdrv_is_allocated() byte-based

2017-06-28 Thread Juan Quintela
l might reasonbly give non-aligned results > in the future; on the other hand, no rounding is needed for callers > that should just continue to work with byte alignment. > > For the most part this patch is just the addition of scaling at the > callers followed by inverse scali

[Qemu-devel] [PATCH v3 18/20] block: Make bdrv_is_allocated() byte-based

2017-06-27 Thread Eric Blake
needed for callers that should just continue to work with byte alignment. For the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no longer has to mess

[Qemu-devel] [PATCH v3 00/20] make bdrv_is_allocated[_above] byte-based

2017-06-27 Thread Eric Blake
at a byte granularity rather than sectors. This is part one of that conversion: bdrv_is_allocated(). Other parts still need a v3, but here's the link to their most recent posting: tracking dirty bitmaps by bytes: https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg03859.html

Re: [Qemu-devel] [PATCH v2 18/20] block: Make bdrv_is_allocated() byte-based

2017-06-05 Thread John Snow
gt; values, where the call might reasonbly give non-aligned results > in the future; on the other hand, no rounding is needed for callers > that should just continue to work with byte alignment. > > For the most part this patch is just the addition of scaling at the > callers follow

Re: [Qemu-devel] [PATCH v2 00/20] make bdrv_is_allocated[_above] byte-based

2017-06-05 Thread John Snow
aturally aligned to sectors or even >> much higher levels). I've therefore started the task of >> converting our block status code to report at a byte granularity >> rather than sectors. >> >> This is part one of that conversion: bdrv_is_allocated(). >> Other

Re: [Qemu-devel] [PATCH v2 00/20] make bdrv_is_allocated[_above] byte-based

2017-06-05 Thread Eric Blake
efore started the task of > converting our block status code to report at a byte granularity > rather than sectors. > > This is part one of that conversion: bdrv_is_allocated(). > Other parts still need a v2, but here's the link to their v1: > tracking dirty bitmaps by bytes: &

[Qemu-devel] [PATCH v2 18/20] block: Make bdrv_is_allocated() byte-based

2017-05-10 Thread Eric Blake
needed for callers that should just continue to work with byte alignment. For the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no longer has to mess

[Qemu-devel] [PATCH v2 00/20] make bdrv_is_allocated[_above] byte-based

2017-05-10 Thread Eric Blake
at a byte granularity rather than sectors. This is part one of that conversion: bdrv_is_allocated(). Other parts still need a v2, but here's the link to their v1: tracking dirty bitmaps by bytes: https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg02163.html replacing bdrv_get_block_statu

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-05-10 Thread Eric Blake
;> /* Skip unallocated sectors; intentionally treats failure as >>>> * an allocated sector */ >>>> while (cur_sector < total_sectors && >>>> - !bdrv_is_allocated(blk_bs(bb), cur_sector, >>>> -

Re: [Qemu-devel] [Qemu-block] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext

2017-05-09 Thread Paolo Bonzini
On 08/05/2017 22:54, Stefan Hajnoczi wrote: > On Fri, May 05, 2017 at 04:03:49PM +0800, jemmy858...@gmail.com wrote: >> From: Lidong Chen >> >> when block migration with high-speed, mig_save_device_bulk hold the >> BQL and invoke bdrv_is_allocated f

Re: [Qemu-devel] [Qemu-block] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext

2017-05-09 Thread Stefan Hajnoczi
speed, mig_save_device_bulk hold the > >> BQL and invoke bdrv_is_allocated frequently. This patch moves > >> bdrv_is_allocated() into bb's AioContext. It will execute without > >> blocking other I/O activity. > >> > >> Signed-off-by: Lidong Chen &g

Re: [Qemu-devel] [Qemu-block] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext

2017-05-09 Thread 858585 jemmy
On Tue, May 9, 2017 at 4:54 AM, Stefan Hajnoczi wrote: > On Fri, May 05, 2017 at 04:03:49PM +0800, jemmy858...@gmail.com wrote: >> From: Lidong Chen >> >> when block migration with high-speed, mig_save_device_bulk hold the >> BQL and invoke bdrv_is_allocated f

Re: [Qemu-devel] [Qemu-block] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext

2017-05-08 Thread Stefan Hajnoczi
On Fri, May 05, 2017 at 04:03:49PM +0800, jemmy858...@gmail.com wrote: > From: Lidong Chen > > when block migration with high-speed, mig_save_device_bulk hold the > BQL and invoke bdrv_is_allocated frequently. This patch moves > bdrv_is_allocated() into bb's AioContext. It

[Qemu-devel] [PATCH v4] migration/block: move bdrv_is_allocated() into bb's AioContext

2017-05-05 Thread jemmy858585
From: Lidong Chen when block migration with high-speed, mig_save_device_bulk hold the BQL and invoke bdrv_is_allocated frequently. This patch moves bdrv_is_allocated() into bb's AioContext. It will execute without blocking other I/O activity. Signed-off-by: Lidong Chen --- v4 chan

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-19 Thread John Snow
t;>> * an allocated sector */ >>> while (cur_sector < total_sectors && >>> - !bdrv_is_allocated(blk_bs(bb), cur_sector, >>> - MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { >>> -

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-19 Thread Eric Blake
le (cur_sector < total_sectors && >> - !bdrv_is_allocated(blk_bs(bb), cur_sector, >> - MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { >> -cur_sector += nr_sectors; >> +

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-19 Thread John Snow
callers are sector-aligned, > but that can be relaxed when a later patch implements byte-based > block status. Therefore, for the most part this patch is just the > addition of scaling at the callers followed by inverse scaling at > bdrv_is_allocated(). But some code, particularly bdrv

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-19 Thread John Snow
t;>> * an allocated sector */ >>> while (cur_sector < total_sectors && >>> - !bdrv_is_allocated(blk_bs(bb), cur_sector, >>> - MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { >>> -

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-19 Thread Eric Blake
le (cur_sector < total_sectors && >> - !bdrv_is_allocated(blk_bs(bb), cur_sector, >> - MAX_IS_ALLOCATED_SEARCH, &nr_sectors)) { >> -cur_sector += nr_sectors; >> +

Re: [Qemu-devel] [Qemu-block] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-18 Thread John Snow
callers are sector-aligned, > but that can be relaxed when a later patch implements byte-based > block status. Therefore, for the most part this patch is just the > addition of scaling at the callers followed by inverse scaling at > bdrv_is_allocated(). But some code, particularly bdrv

Re: [Qemu-devel] [Qemu-block] [PATCH 00/17] make bdrv_is_allocated[_above] byte-based

2017-04-17 Thread Eric Blake
to sectors or even >> much higher levels). I've therefore started the task of >> converting our block status code to report at a byte granularity >> rather than sectors. >> >> This is part one of that conversion: bdrv_is_allocated(). >> Other parts (still t

Re: [Qemu-devel] [Qemu-block] [PATCH 00/17] make bdrv_is_allocated[_above] byte-based

2017-04-17 Thread John Snow
started the task of > converting our block status code to report at a byte granularity > rather than sectors. > > This is part one of that conversion: bdrv_is_allocated(). > Other parts (still to be written) include tracking dirty bitmaps > by bytes (it's still one bit per g

[Qemu-devel] [PATCH 16/17] block: Make bdrv_is_allocated() byte-based

2017-04-11 Thread Eric Blake
-based block status. Therefore, for the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no longer has to mess with sectors; also, it is now possible to pass

[Qemu-devel] [PATCH 00/17] make bdrv_is_allocated[_above] byte-based

2017-04-11 Thread Eric Blake
at a byte granularity rather than sectors. This is part one of that conversion: bdrv_is_allocated(). Other parts (still to be written) include tracking dirty bitmaps by bytes (it's still one bit per granularity, but now we won't be double-scaling from bytes to sectors to granularity),

[Qemu-devel] [PULL 06/12] migration: Document handling of bdrv_is_allocated() errors

2017-03-13 Thread Kevin Wolf
From: Eric Blake Migration is the only code left in the tree that does not react to bdrv_is_allocated() failures. But as there is no useful way to react to the failure, and we are merely skipping unallocated sectors on success, just document that our choice of handling is intended. Signed-off

[Qemu-devel] [PULL 05/12] vvfat: React to bdrv_is_allocated() errors

2017-03-13 Thread Kevin Wolf
From: Eric Blake If bdrv_is_allocated() fails, we should react to that failure. For 2 of the 3 callers, reporting the error was easy. But in cluster_was_modified() and its lone caller get_cluster_count_for_direntry(), it's rather invasive to update the logic to pass the error back; so the

[Qemu-devel] [PULL 04/12] backup: React to bdrv_is_allocated() errors

2017-03-13 Thread Kevin Wolf
From: Eric Blake If bdrv_is_allocated() fails, we should immediately do the backup error action, rather than attempting backup_do_cow() (although that will likely fail too). Signed-off-by: Eric Blake Signed-off-by: Kevin Wolf --- block/backup.c | 14 ++ 1 file changed, 10

Re: [Qemu-devel] [PATCH for-2.9 0/3] Fix bdrv_is_allocated usage bugs

2017-03-09 Thread Kevin Wolf
Am 08.03.2017 um 22:34 hat Eric Blake geschrieben: > bdrv_is_allocated() returns tri-state, not just bool, although > there were several callers using it as a bool. Fix them to > either propagate the error or to document why treatment of > failure like allocation is okay. > &g

[Qemu-devel] [PATCH 1/3] backup: React to bdrv_is_allocated() errors

2017-03-08 Thread Eric Blake
If bdrv_is_allocated() fails, we should immediately do the backup error action, rather than attempting backup_do_cow() (although that will likely fail too). Signed-off-by: Eric Blake --- block/backup.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block

[Qemu-devel] [PATCH 2/3] vvfat: React to bdrv_is_allocated() errors

2017-03-08 Thread Eric Blake
If bdrv_is_allocated() fails, we should react to that failure. For 2 of the 3 callers, reporting the error was easy. But in cluster_was_modified() and its lone caller get_cluster_count_for_direntry(), it's rather invasive to update the logic to pass the error back; so there, I went with m

[Qemu-devel] [PATCH for-2.9 0/3] Fix bdrv_is_allocated usage bugs

2017-03-08 Thread Eric Blake
bdrv_is_allocated() returns tri-state, not just bool, although there were several callers using it as a bool. Fix them to either propagate the error or to document why treatment of failure like allocation is okay. [Found during a larger effort to convert bdrv_get_block_status to be byte-based

[Qemu-devel] [PATCH 3/3] migration: Document handling of bdrv_is_allocated() errors

2017-03-08 Thread Eric Blake
Migration is the only code left in the tree that does not react to bdrv_is_allocated() failures. But as there is no useful way to react to the failure, and we are merely skipping unallocated sectors on success, just document that our choice of handling is intended. Signed-off-by: Eric Blake

[Qemu-devel] [PULL v2 for-2.1 02/22] block: Fix bdrv_is_allocated() return value

2014-07-14 Thread Kevin Wolf
bdrv_is_allocated() should return either 0 or 1 in successful cases. We're lucky that currently, the callers that rely on this (e.g. because they check for ret == 1) don't seem to break badly. They just might skip some optimisation or in the case of qemu-io 'map' print se

[Qemu-devel] [PULL for-2.1 02/22] block: Fix bdrv_is_allocated() return value

2014-07-10 Thread Kevin Wolf
bdrv_is_allocated() should return either 0 or 1 in successful cases. We're lucky that currently, the callers that rely on this (e.g. because they check for ret == 1) don't seem to break badly. They just might skip some optimisation or in the case of qemu-io 'map' print se

Re: [Qemu-devel] [PATCH for-2.1] block: Fix bdrv_is_allocated() return value

2014-07-08 Thread Kevin Wolf
Am 07.07.2014 um 17:37 hat Kevin Wolf geschrieben: > bdrv_is_allocated() should return either 0 or 1 in successful cases. > We're lucky that currently, the callers that rely on this (e.g. because > they check for ret == 1) don't seem to break badly. They just might skip > s

Re: [Qemu-devel] [PATCH for-2.1] block: Fix bdrv_is_allocated() return value

2014-07-07 Thread Eric Blake
On 07/07/2014 09:37 AM, Kevin Wolf wrote: > bdrv_is_allocated() should return either 0 or 1 in successful cases. > We're lucky that currently, the callers that rely on this (e.g. because > they check for ret == 1) don't seem to break badly. They just might skip > some optim

[Qemu-devel] [PATCH for-2.1] block: Fix bdrv_is_allocated() return value

2014-07-07 Thread Kevin Wolf
bdrv_is_allocated() should return either 0 or 1 in successful cases. We're lucky that currently, the callers that rely on this (e.g. because they check for ret == 1) don't seem to break badly. They just might skip some optimisation or in the case of qemu-io 'map' print se

[Qemu-devel] [PULL 01/22] block: Fix bdrv_is_allocated() for short backing files

2014-05-19 Thread Kevin Wolf
bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c | 10 ++ include/

Re: [Qemu-devel] [PATCH v2] block: Fix bdrv_is_allocated() for short backing files

2014-05-08 Thread Max Reitz
On 07.05.2014 10:31, Kevin Wolf wrote: bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf --- v2: - Set BDRV_BLOCK_ALLOCATE

[Qemu-devel] [PATCH v2] block: Fix bdrv_is_allocated() for short backing files

2014-05-07 Thread Kevin Wolf
bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf --- v2: - Set BDRV_BLOCK_ALLOCATED for !drv->bdrv_co_get_block_sta

Re: [Qemu-devel] [PATCH] block: Fix bdrv_is_allocated() for short backing files

2014-05-07 Thread Kevin Wolf
Am 06.05.2014 um 21:53 hat Max Reitz geschrieben: > On 06.05.2014 15:30, Kevin Wolf wrote: > >bdrv_is_allocated() shouldn't return true for sectors that are > >unallocated, but after the end of a short backing file, even though > >such sectors are (correctly)

Re: [Qemu-devel] [PATCH] block: Fix bdrv_is_allocated() for short backing files

2014-05-06 Thread Max Reitz
On 06.05.2014 15:30, Kevin Wolf wrote: bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf --- block.c

Re: [Qemu-devel] [PATCH] block: Fix bdrv_is_allocated() for short backing files

2014-05-06 Thread Paolo Bonzini
Il 06/05/2014 15:30, Kevin Wolf ha scritto: bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf Nice. :) Paolo

[Qemu-devel] [PATCH] block: Fix bdrv_is_allocated() for short backing files

2014-05-06 Thread Kevin Wolf
bdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros. Signed-off-by: Kevin Wolf --- block.c | 8 +--- include/block/block.h

[Qemu-devel] [PATCH 20/41] block: use public bdrv_is_allocated() interface

2011-12-05 Thread Kevin Wolf
From: Stefan Hajnoczi There is no need for bdrv_commit() to use the BlockDriver .bdrv_is_allocated() interface directly. Converting to the public interface gives us the freedom to drop .bdrv_is_allocated() entirely in favor of a new .bdrv_co_is_allocated() in the future. Signed-off-by: Stefan

[Qemu-devel] [PATCH 27/41] block: drop .bdrv_is_allocated() interface

2011-12-05 Thread Kevin Wolf
From: Stefan Hajnoczi Now that all block drivers have been converted to .bdrv_co_is_allocated() we can drop .bdrv_is_allocated(). Note that the public bdrv_is_allocated() interface is still available but is in fact a synchronous wrapper around .bdrv_co_is_allocated(). Signed-off-by: Stefan

Re: [Qemu-devel] [PATCH v2 0/9] block: replace .bdrv_is_allocated() with .bdrv_co_is_allocated()

2011-11-23 Thread Kevin Wolf
Am 14.11.2011 13:44, schrieb Stefan Hajnoczi: > The bdrv_is_allocated() interface is not suitable for use while the VM is > running. It is a synchronous interface so it may block the running VM for > arbitrary amounts of time. It also assumes it is the only block driver > operation

[Qemu-devel] [PATCH v2 1/9] block: use public bdrv_is_allocated() interface

2011-11-14 Thread Stefan Hajnoczi
There is no need for bdrv_commit() to use the BlockDriver .bdrv_is_allocated() interface directly. Converting to the public interface gives us the freedom to drop .bdrv_is_allocated() entirely in favor of a new .bdrv_co_is_allocated() in the future. Signed-off-by: Stefan Hajnoczi --- block.c

[Qemu-devel] [PATCH v2 8/9] block: drop .bdrv_is_allocated() interface

2011-11-14 Thread Stefan Hajnoczi
Now that all block drivers have been converted to .bdrv_co_is_allocated() we can drop .bdrv_is_allocated(). Note that the public bdrv_is_allocated() interface is still available but is in fact a synchronous wrapper around .bdrv_co_is_allocated(). Signed-off-by: Stefan Hajnoczi --- block.c

[Qemu-devel] [PATCH v2 0/9] block: replace .bdrv_is_allocated() with .bdrv_co_is_allocated()

2011-11-14 Thread Stefan Hajnoczi
The bdrv_is_allocated() interface is not suitable for use while the VM is running. It is a synchronous interface so it may block the running VM for arbitrary amounts of time. It also assumes it is the only block driver operation and there is a risk that internal state could be corrupted if

[Qemu-devel] [PATCH 09/10] block: drop .bdrv_is_allocated() interface

2011-11-11 Thread Stefan Hajnoczi
Now that all block drivers have been converted to .bdrv_co_is_allocated() we can drop .bdrv_is_allocated(). Note that the public bdrv_is_allocated() interface is still available but is in fact a synchronous wrapper around .bdrv_co_is_allocated(). Signed-off-by: Stefan Hajnoczi --- block.c

[Qemu-devel] [PATCH 01/10] block: use public bdrv_is_allocated() interface

2011-11-11 Thread Stefan Hajnoczi
There is no need for bdrv_commit() to use the BlockDriver .bdrv_is_allocated() interface directly. Converting to the public interface gives us the freedom to drop .bdrv_is_allocated() entirely in favor of a new .bdrv_co_is_allocated() in the future. Signed-off-by: Stefan Hajnoczi --- block.c

[Qemu-devel] [PATCH 00/10] block: replace .bdrv_is_allocated() with .bdrv_co_is_allocated()

2011-11-11 Thread Stefan Hajnoczi
The bdrv_is_allocated() interface is not suitable for use while the VM is running. It is a synchronous interface so it may block the running VM for arbitrary amounts of time. It also assumes it is the only block driver operation and there is a risk that internal state could be corrupted if

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-17 Thread Stefan Hajnoczi
On Thu, Jun 16, 2011 at 9:10 AM, Dmitry Konishchev wrote: > On Wed, Jun 15, 2011 at 5:57 PM, Stefan Hajnoczi wrote: >> Anyway, bdrv_getlength() will return the total_sectors value instead >> of calling into raw-posix.c .bdrv_getlength().  That's why it should >> be cheap. > > Yeah, I see it now a

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-16 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 5:57 PM, Stefan Hajnoczi wrote: > Anyway, bdrv_getlength() will return the total_sectors value instead > of calling into raw-posix.c .bdrv_getlength().  That's why it should > be cheap. Yeah, I see it now after a closer look in the drivers code. It looks like I get this 9%

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
2011/6/15 Dmitry Konishchev : > On Wed, Jun 15, 2011 at 5:33 PM, Stefan Hajnoczi wrote: >> "disable caching"? > > Image geometry caching. I meant If I call bdrv_get_geometry() every > time I need image geometry instead of obtaining it from bs_geometry > variable. Haha, sorry. Too much caching: -

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 5:33 PM, Stefan Hajnoczi wrote: > "disable caching"? Image geometry caching. I meant If I call bdrv_get_geometry() every time I need image geometry instead of obtaining it from bs_geometry variable. -- Дмитрий Конищев (Dmitry Konishchev) mailto:konishc...@gmail.com

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
On Wed, Jun 15, 2011 at 2:14 PM, Dmitry Konishchev wrote: > On Wed, Jun 15, 2011 at 4:02 PM, Stefan Hajnoczi wrote: >> We need to fully understand performance before applying optimizations >> on top.  Otherwise it is possible to paper over a problem while >> leaving the root cause unsolved.  Avoi

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 4:02 PM, Stefan Hajnoczi wrote: > We need to fully understand performance before applying optimizations > on top.  Otherwise it is possible to paper over a problem while > leaving the root cause unsolved.  Avoiding lseek(2) is very important, > not just for qemu-img but als

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
On Wed, Jun 15, 2011 at 10:50 AM, Dmitry Konishchev wrote: > On Wed, Jun 15, 2011 at 12:39 PM, Stefan Hajnoczi wrote: >> Why is bdrv_get_geometry() slow? > > Mmm.. Frankly, I haven't looked so deep, but it is going to be slow at > least for raw images due to using lseek(). We need to fully under

[Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
continue; +} + +if (bs_sector + n <= cur_sectors) { +cur_n = n; +} else { +cur_n = cur_sectors - bs_sector; +} + +if (bdrv_is_allocated(cur_bs, bs_sector, cur_n, &allocated_num)) { +

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 12:39 PM, Stefan Hajnoczi wrote: > Why is bdrv_get_geometry() slow? Mmm.. Frankly, I haven't looked so deep, but it is going to be slow at least for raw images due to using lseek(). -- Dmitry Konishchev mailto:konishc...@gmail.com

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
On Wed, Jun 15, 2011 at 8:38 AM, Dmitry Konishchev wrote: > On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: >> Yes, please. > > OK, I'll do it as soon I'll find time for it. > > > On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: >> For image files the block layer should be caching

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: > Yes, please. OK, I'll do it as soon I'll find time for it. On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: > For image files the block layer should be caching the device capacity (size) > anyway, so you probably don't need to al

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-14 Thread Stefan Hajnoczi
On Tue, Jun 14, 2011 at 8:43 AM, Dmitry Konishchev wrote: > On Mon, Jun 13, 2011 at 1:13 PM, Dmitry Konishchev > wrote: >> I haven't done this because in this case I have to pass too lot of >> local variables to this function. Just not sure that it'll look >> better. But if you mind I surely can

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-14 Thread Dmitry Konishchev
On Mon, Jun 13, 2011 at 1:13 PM, Dmitry Konishchev wrote: > I haven't done this because in this case I have to pass too lot of > local variables to this function. Just not sure that it'll look > better. But if you mind I surely can do this. Should I? -- Dmitry Konishchev mailto:konishc...@gmail.

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-13 Thread Dmitry Konishchev
On Mon, Jun 13, 2011 at 12:26 PM, Stefan Hajnoczi wrote: > The optimization is to check allocation metadata instead of > unconditionally reading and then checking for all zeroes? Yeah, exactly. On Mon, Jun 13, 2011 at 12:26 PM, Stefan Hajnoczi wrote: > Why introduce a new constant instead of usi

  1   2   >