Re: [Qemu-block] [PATCH v4 2/6] replication: add shared-disk and shared-disk-id options

2017-04-17 Thread Xie Changlong
On 04/12/2017 10:05 PM, zhanghailiang wrote: We use these two options to identify which disk is shared Signed-off-by: zhanghailiang Signed-off-by: Wen Congyang Signed-off-by: Zhang Chen --- v4: - Add proper comment for primary_disk (Stefan) v2: - Move g_free(s->shared_disk_id) to the common

Re: [Qemu-block] [Qemu-devel] [PATCH 26/31] vdi: Avoid bitrot of debugging code

2017-04-17 Thread Stefan Weil
Am 18.04.2017 um 03:33 schrieb Eric Blake: Rework the debug define so that we always get -Wformat checking, even when debugging is disabled. Signed-off-by: Eric Blake --- Reviewed-by: Stefan Weil block/vdi.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a

[Qemu-block] [PATCH] MAINTAINERS: update Wen's email address

2017-04-17 Thread Changlong Xie
So he can get CC'ed on future patches and bugs for this feature Signed-off-by: Changlong Xie --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index c60235e..5638992 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1817,7 +1817,7 @@ S: Su

Re: [Qemu-block] [Qemu-devel] [PULL 2/8] replication: clarify permissions

2017-04-17 Thread Xie Changlong
On 04/18/2017 09:36 AM, Hailiang Zhang wrote: On 2017/4/18 9:23, Eric Blake wrote: On 03/17/2017 08:15 AM, Kevin Wolf wrote: From: Changlong Xie Even if hidden_disk, secondary_disk are backing files, they all need write permissions in replication scenario. Otherwise we will encouter below e

[Qemu-block] [PATCH 30/31] vvfat: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the vvfat driver accordingly. Signed-off-by: Eric Blake --- block/vvfat.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index bef2056..825fe72 1

Re: [Qemu-block] [PATCH 00/31] make bdrv_get_block_status byte-based

2017-04-17 Thread Eric Blake
On 04/17/2017 08:33 PM, Eric Blake wrote: > There are patches floating around to add NBD_CMD_BLOCK_STATUS, > but NBD wants to report status on byte granularity (even if the > reporting will probably be naturally aligned to sectors or even > much higher levels). I've therefore started the task of >

[Qemu-block] [PATCH 29/31] vpc: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the vpc driver accordingly. Signed-off-by: Eric Blake --- block/vpc.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index ecfee

[Qemu-block] [PATCH 28/31] vmdk: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the vmdk driver accordingly. Signed-off-by: Eric Blake --- block/vmdk.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index c61b9cc.

[Qemu-block] [PATCH 26/31] vdi: Avoid bitrot of debugging code

2017-04-17 Thread Eric Blake
Rework the debug define so that we always get -Wformat checking, even when debugging is disabled. Signed-off-by: Eric Blake --- block/vdi.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index d12d9cd..a70b969 100644 --- a/block/vdi.c +

[Qemu-block] [PATCH 24/31] raw: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the raw driver accordingly. Signed-off-by: Eric Blake --- block/raw-format.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/block/raw-format.c b/block/raw-format.c index 3

Re: [Qemu-block] [Qemu-devel] [PULL 2/8] replication: clarify permissions

2017-04-17 Thread Hailiang Zhang
On 2017/4/18 9:23, Eric Blake wrote: On 03/17/2017 08:15 AM, Kevin Wolf wrote: From: Changlong Xie Even if hidden_disk, secondary_disk are backing files, they all need write permissions in replication scenario. Otherwise we will encouter below exceptions on secondary side during adding nbd ser

[Qemu-block] [PATCH 20/31] parallels: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the parallels driver accordingly. Note that the internal function block_status() is still sector-based, because it is still in use by other sector-based functions; but that's okay because request_alignment is 51

[Qemu-block] [PATCH 25/31] sheepdog: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the sheepdog driver accordingly. Signed-off-by: Eric Blake --- block/sheepdog.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c

[Qemu-block] [PATCH 23/31] qed: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the qed driver accordingly. Signed-off-by: Eric Blake --- block/qed.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/block/qed.c b/block/qed.c index fd76817..336da

[Qemu-block] [PATCH 22/31] qcow2: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the qcow2 driver accordingly. Signed-off-by: Eric Blake --- block/qcow2.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 4272cca..0de7

[Qemu-block] [PATCH 11/31] block: Add .bdrv_co_block_status() callback

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Now that the block layer exposes byte-based allocation, it's time to tackle the drivers. Add a new callback that operates on as small as byte boundaries, and update the block layer to ensure that the callback is only us

[Qemu-block] [PATCH 21/31] qcow: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the qcow driver accordingly. Signed-off-by: Eric Blake --- block/qcow.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/block/qcow.c b/block/qcow.c index 5d147b9..d

[Qemu-block] [PATCH 31/31] block: Drop unused .bdrv_co_get_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Now that all drivers have been updated to provide the byte-based .bdrv_co_block_status(), we can delete the sector-based interface. Signed-off-by: Eric Blake --- include/block/block_int.h | 3 --- block/io.c

[Qemu-block] [PATCH 14/31] gluster: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the gluster driver accordingly. Signed-off-by: Eric Blake --- block/gluster.c | 47 +++ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/block/gluster

[Qemu-block] [PATCH 10/31] block: Convert bdrv_get_block_status_above() to bytes

2017-04-17 Thread Eric Blake
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 precise about allocation at the end of an unaligned file

[Qemu-block] [PATCH 27/31] vdi: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the vdi driver accordingly. Note that the TODO is already covered (the block layer guarantees bounds of its requests), and that we can remove the now-unused s->block_sectors. Signed-off-by: Eric Blake --- blo

[Qemu-block] [PATCH 18/31] mirror: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the mirror driver accordingly. Signed-off-by: Eric Blake --- block/mirror.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 750be1f..ebd0adf

[Qemu-block] [PATCH 16/31] iscsi: Switch iscsi_allocmap_update() to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Convert all uses of the allocmap (no semantic change). Callers that already had bytes available are simpler, and callers that now scale to bytes will be easier to switch to byte-based in th

[Qemu-block] [PATCH 19/31] null: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the null driver accordingly. Signed-off-by: Eric Blake --- block/null.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/block/null.c b/block/null.c index b300390..2d

[Qemu-block] [PATCH 17/31] iscsi: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the iscsi driver accordingly. In this case, it is handy to teach iscsi_co_block_status() to handle a NULL file parameter, even though the block layer passes a non-NULL value, because we also call the function di

[Qemu-block] [PATCH 15/31] iscsi: Switch cluster_sectors to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Convert all uses of the cluster size in sectors, along with adding assertions that we are not dividing by zero. Signed-off-by: Eric Blake --- block/iscsi.c | 56 ++

[Qemu-block] [PATCH 09/31] block: Switch bdrv_co_get_block_status_above() to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Convert another internal type (no semantic change), and rename it to match the corresponding public function rename. Signed-off-by: Eric Blake --- block/io.c | 42

[Qemu-block] [PATCH 13/31] file-posix: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the file protocol driver accordingly. Signed-off-by: Eric Blake --- block/file-posix.c | 47 +++ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/bloc

[Qemu-block] [PATCH 12/31] commit: Switch to .bdrv_co_block_status()

2017-04-17 Thread Eric Blake
We are gradually moving away from sector-based interfaces, towards byte-based. Update the commit driver accordingly. Signed-off-by: Eric Blake --- block/commit.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/commit.c b/block/commit.c index 989de7d..1cc7a00

[Qemu-block] [PATCH 04/31] block: Switch bdrv_make_zero() to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Change the internal loop iteration of zeroing a device to track by bytes instead of sectors (although we are still guaranteed that we iterate by steps that are sector-aligned). Signed-off-b

[Qemu-block] [PATCH 08/31] block: Switch BdrvCoGetBlockStatusData to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Convert another internal type (no semantic change), and rename it to match the corresponding public function rename. Signed-off-by: Eric Blake --- block/io.c | 30 +---

[Qemu-block] [PATCH 06/31] block: Convert bdrv_get_block_status() to bytes

2017-04-17 Thread Eric Blake
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 precise about allocation at the end of an unaligned file

[Qemu-block] [PATCH 07/31] block: Switch bdrv_co_get_block_status() to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Convert another internal function (no semantic change), and as with its public counterpart, rename to bdrv_co_block_status() to make the compiler enforce that we catch all uses. For now, we

[Qemu-block] [PATCH 01/31] block: Drop unused bdrv_round_sectors_to_clusters()

2017-04-17 Thread Eric Blake
Now that the last user [mirror_iteration()] has converted to using bytes, we no longer need a function to round sectors to clusters. Signed-off-by: Eric Blake --- include/block/block.h | 4 block/io.c| 21 - 2 files changed, 25 deletions(-) diff --git a/inc

[Qemu-block] [PATCH 00/31] make bdrv_get_block_status byte-based

2017-04-17 Thread Eric Blake
There are patches floating around to add NBD_CMD_BLOCK_STATUS, but NBD wants to report status on byte granularity (even if the reporting will probably be naturally aligned to sectors or even much higher levels). I've therefore started the task of converting our block status code to report at a byt

[Qemu-block] [PATCH 03/31] qcow2: Switch is_zero_sectors() to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Convert another internal function (no semantic change), and rename it to is_zero_above() in the process. Signed-off-by: Eric Blake --- block/qcow2.c | 32 ++--

[Qemu-block] [PATCH 02/31] block: Make bdrv_round_to_clusters() signature more useful

2017-04-17 Thread Eric Blake
In the process of converting sector-based interfaces to bytes, I'm finding it easier to represent a byte count as a 64-bit integer at the block layer (even if we are internally capped by SIZE_MAX or even INT_MAX for individual transactions, it's still nicer to not have to worry about truncation/ove

[Qemu-block] [PATCH 05/31] qemu-img: Switch get_block_status() to byte-based

2017-04-17 Thread Eric Blake
We are gradually converting to byte-based interfaces, as they are easier to reason about than sector-based. Continue by converting an internal function (no semantic change), and simplifying its caller accordingly. Signed-off-by: Eric Blake --- qemu-img.c | 24 +++- 1 file ch

Re: [Qemu-block] [Qemu-devel] [PULL 2/8] replication: clarify permissions

2017-04-17 Thread Eric Blake
On 03/17/2017 08:15 AM, Kevin Wolf wrote: > From: Changlong Xie > > Even if hidden_disk, secondary_disk are backing files, they all need > write permissions in replication scenario. Otherwise we will encouter > below exceptions on secondary side during adding nbd server: > > {'execute': 'nbd-ser

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

2017-04-17 Thread Eric Blake
On 04/17/2017 06:42 PM, John Snow wrote: > > > On 04/11/2017 06:29 PM, Eric Blake wrote: >> There are patches floating around to add NBD_CMD_BLOCK_STATUS, >> but NBD wants to report status on byte granularity (even if the >> reporting will probably be naturally aligned to sectors or even >> much

Re: [Qemu-block] [PATCH 13/17] backup: Switch block_backup.h to byte-based

2017-04-17 Thread Eric Blake
On 04/17/2017 06:24 PM, John Snow wrote: > > > On 04/11/2017 06:29 PM, Eric Blake wrote: >> We are gradually converting to byte-based interfaces, as they are >> easier to reason about than sector-based. Continue by converting >> the public interface to backup jobs (no semantic change), including

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

2017-04-17 Thread John Snow
On 04/11/2017 06:29 PM, Eric Blake wrote: > There are patches floating around to add NBD_CMD_BLOCK_STATUS, > but NBD wants to report status on byte granularity (even if the > reporting will probably be naturally aligned to sectors or even > much higher levels). I've therefore started the task of

Re: [Qemu-block] [PATCH 13/17] backup: Switch block_backup.h to byte-based

2017-04-17 Thread John Snow
On 04/11/2017 06:29 PM, Eric Blake wrote: > We are gradually converting to byte-based interfaces, as they are > easier to reason about than sector-based. Continue by converting > the public interface to backup jobs (no semantic change), including > a change to CowRequest to track by bytes instea

Re: [Qemu-block] [PATCH 02/17] trace: Show blockjob actions via bytes, not sectors

2017-04-17 Thread Eric Blake
On 04/17/2017 02:18 PM, John Snow wrote: >> @@ -346,13 +349,15 @@ static uint64_t coroutine_fn >> mirror_iteration(MirrorBlockJob *s) >> if (sector_num < 0) { >> bdrv_set_dirty_iter(s->dbi, 0); >> sector_num = bdrv_dirty_iter_next(s->dbi); >> -trace_mirror_restart_i

Re: [Qemu-block] [PATCH 01/17] blockjob: Track job ratelimits via bytes, not sectors

2017-04-17 Thread Eric Blake
On 04/17/2017 02:18 PM, John Snow wrote: > > > On 04/11/2017 06:29 PM, Eric Blake wrote: >> The user interface specifies job rate limits in bytes/second. >> It's pointless to have our internal representation track things >> in sectors/second, particularly since we want to move away from >> sector

Re: [Qemu-block] [PATCH 01/17] blockjob: Track job ratelimits via bytes, not sectors

2017-04-17 Thread John Snow
On 04/11/2017 06:29 PM, Eric Blake wrote: > The user interface specifies job rate limits in bytes/second. > It's pointless to have our internal representation track things > in sectors/second, particularly since we want to move away from > sector-based interfaces. > > Fix up a doc typo found whi

Re: [Qemu-block] [PATCH 02/17] trace: Show blockjob actions via bytes, not sectors

2017-04-17 Thread John Snow
On 04/11/2017 06:29 PM, Eric Blake wrote: > Upcoming patches are going to switch to byte-based interfaces > instead of sector-based. Even worse, trace_backup_do_cow_enter() > had a weird mix of cluster and sector indices. Make the tracing > uniformly use bytes. > > Signed-off-by: Eric Blake >

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 1/2] block: An empty filename counts as no filename

2017-04-17 Thread Philippe Mathieu-Daudé
Hi Max, On 04/13/2017 01:06 PM, Max Reitz wrote: Reproducer: $ ./qemu-img info '' qemu-img: ./block.c:1008: bdrv_open_driver: Assertion `!drv->bdrv_needs_filename || bs->filename[0]' failed. [1]26105 abort (core dumped) ./qemu-img info '' This patch fixes this to be:

Re: [Qemu-block] [Qemu-devel] [PATCH v2 for-2.10 12/16] block/qcow2: Extract qcow2_calc_size_usage()

2017-04-17 Thread Philippe Mathieu-Daudé
On 04/03/2017 01:09 PM, Max Reitz wrote: We will need very similar functionality for full/falloc preallocation in qcow2_truncate(). Although we will not be able to reuse much of the actual code, it still makes sense to keep all of this in one place. Signed-off-by: Max Reitz Reviewed-by: Stefan

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.9-rc5 v2] block: Drain BH in bdrv_drained_begin

2017-04-17 Thread Jeff Cody
On Mon, Apr 17, 2017 at 04:27:19PM +0800, Fam Zheng wrote: > On Fri, 04/14 09:51, Stefan Hajnoczi wrote: > > On Fri, Apr 14, 2017 at 9:02 AM, Fam Zheng wrote: > > > @@ -398,11 +399,15 @@ void bdrv_drain_all(void); > > > */\ > > > a

Re: [Qemu-block] [PATCH for-2.9-rc5 v2] block: Drain BH in bdrv_drained_begin

2017-04-17 Thread Fam Zheng
On Fri, 04/14 09:51, Stefan Hajnoczi wrote: > On Fri, Apr 14, 2017 at 9:02 AM, Fam Zheng wrote: > > @@ -398,11 +399,15 @@ void bdrv_drain_all(void); > > */\ > > assert(!bs_->wakeup); \ > > bs_-

Re: [Qemu-block] [Qemu-devel] [PATCH for-2.10 0/2] block: An empty filename counts as no filename

2017-04-17 Thread Fam Zheng
On Thu, 04/13 18:06, Max Reitz wrote: > See patch 1 for what is happening when you try "qemu-img info ''" and > for the fix. > > (Patch 2 just adds a simple test.) Reviewed-by: Fam Zheng