[Qemu-block] [PATCH v6 08/12] block: Add "drained begin/end" for transactional blockdev-backup

2015-10-22 Thread Fam Zheng
Similar to the previous patch, make sure that external events are not dispatched during transaction operations. Signed-off-by: Fam Zheng Reviewed-by: Jeff Cody Reviewed-by: Kevin Wolf --- blockdev.c | 9 - 1 file changed, 8

[Qemu-block] [PATCH v3 04/21] util: Infrastructure for computing recent averages

2015-10-22 Thread Alberto Garcia
This module computes the average of a set of values within a time window, keeping also track of the minimum and maximum values. In order to produce more accurate results it works internally by creating two time windows of the same period, offsetted by half of that period. Values are accounted on

Re: [Qemu-block] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Paolo Bonzini
On 22/10/2015 10:17, Fam Zheng wrote: > When qcow2 is created on iscsi target with a virtual size greater than > physical > capacity of the LUN, over time it's possible that guest fills too much data > and > at that point, new clusters in qcow2 will be allocated beyond the end of disk. > >

[Qemu-block] [PATCH v6 02/12] nbd: Mark fd handlers client type as "external"

2015-10-22 Thread Fam Zheng
So we could distinguish it from internal used fds, thus avoid handling unwanted events in nested aio polls. Signed-off-by: Fam Zheng Reviewed-by: Jeff Cody Reviewed-by: Kevin Wolf --- nbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[Qemu-block] [PATCH v3 21/21] block: Update copyright of the accounting code

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- block/accounting.c | 1 + include/block/accounting.h | 1 + 2 files changed, 2 insertions(+) diff --git a/block/accounting.c b/block/accounting.c index 05a5c5f..185025e 100644 --- a/block/accounting.c +++ b/block/accounting.c @@ -2,6

[Qemu-block] [PATCH v3 17/21] atapi: Account for failed and invalid operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/ide/atapi.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 747f466..cf0b78e 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -108,27 +108,30 @@

[Qemu-block] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Fam Zheng
When qcow2 is created on iscsi target with a virtual size greater than physical capacity of the LUN, over time it's possible that guest fills too much data and at that point, new clusters in qcow2 will be allocated beyond the end of disk. werror=enospc is useful for that purpose to allocate more

[Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Fam Zheng
Previously we return -EIO blindly when anything goes wrong. Add a helper function to parse sense fields and try to make the return code more meaningful. Signed-off-by: Fam Zheng --- block/iscsi.c | 56 +++- 1 file changed, 55

[Qemu-block] [PATCH v3 11/21] qemu-io: Account for failed, invalid and flush operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- qemu-io-cmds.c | 9 + 1 file changed, 9 insertions(+) diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 6e5d1e4..0cac623 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -1364,6 +1364,7 @@ static void aio_write_done(void *opaque,

[Qemu-block] [PATCH v3 20/21] scsi-disk: Account for failed operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/scsi/scsi-disk.c | 46 +++--- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index bada9a7..20a31a7 100644 --- a/hw/scsi/scsi-disk.c +++

Re: [Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Paolo Bonzini
On 22/10/2015 10:31, Peter Lieven wrote: > > +switch (sense->key) { > +case SCSI_SENSE_NO_SENSE: > +return 0; > +break; > +case SCSI_SENSE_NOT_READY: > +return -EBUSY; > +break; > +case SCSI_SENSE_DATA_PROTECTION: > +return -EACCES;

Re: [Qemu-block] [PATCH v5 02/12] nbd: Mark fd handlers client type as "external"

2015-10-22 Thread Jeff Cody
On Wed, Oct 21, 2015 at 10:06:39AM +0800, Fam Zheng wrote: > So we could distinguish it from internal used fds, thus avoid handling > unwanted events in nested aio polls. > > Signed-off-by: Fam Zheng > --- > nbd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >

[Qemu-block] [PATCH v3 09/21] block: Add average I/O queue depth to BlockDeviceTimedStats

2015-10-22 Thread Alberto Garcia
This patch adds two new fields to BlockDeviceTimedStats that track the average number of pending read and write requests for a block device. The values are calculated for the period of time defined for that interval. Signed-off-by: Alberto Garcia --- block/accounting.c

[Qemu-block] [PATCH v3 00/21] Extended I/O accounting

2015-10-22 Thread Alberto Garcia
Here's a new version of the extended I/O accounting patches. This one is rebased on top of the current master, has a few minor documentation fixes and drops the 'supports_stats' field completely. Regards, Berto v3: - Rebased on top of the current master and on Max's BlockBackend series v7 -

[Qemu-block] [PATCH v3 01/21] xen_disk: Account for flush operations

2015-10-22 Thread Alberto Garcia
Currently both BLKIF_OP_WRITE and BLKIF_OP_FLUSH_DISKCACHE are being accounted as write operations. Signed-off-by: Alberto Garcia Reviewed-by: Stefan Hajnoczi --- hw/block/xen_disk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

Re: [Qemu-block] [PATCH] throttle: Remove throttle_group_lock/unlock()

2015-10-22 Thread Kevin Wolf
Am 21.10.2015 um 20:36 hat Alberto Garcia geschrieben: > The group throttling code was always meant to handle its locking > internally. However, bdrv_swap() was touching the ThrottleGroup > structure directly and therefore needed an API for that. > > Now that bdrv_swap() no longer exists there's

Re: [Qemu-block] [Qemu-devel] [RFC] transactions: add transaction-wide property

2015-10-22 Thread Stefan Hajnoczi
Thanks for summarizing the discussion! If you are taking over Fam's series, please squash in your patches to make review easier. Maybe the names can be improved: "allow-partial" is not self-explanatory. "sync-cancel" is misleading since successful completion is affected too, not just

[Qemu-block] [PATCH v6 10/12] block: Introduce BlockDriver.bdrv_drain callback

2015-10-22 Thread Fam Zheng
Drivers can have internal request sources that generate IO, like the need_check_timer in QED. Since we want quiesced periods that contain nested event loops in block layer, we need to have a way to disable such event sources. Block drivers must implement the "bdrv_drain" callback if it has any

[Qemu-block] [PATCH v6 09/12] block: Add "drained begin/end" for internal snapshot

2015-10-22 Thread Fam Zheng
This ensures the atomicity of the transaction by avoiding processing of external requests such as those from ioeventfd. state->bs is assigned right after bdrv_drained_begin. Because it was used as the flag for deletion or not in abort, now we need a separate flag - InternalSnapshotState.created.

[Qemu-block] [PATCH v6 03/12] dataplane: Mark host notifiers' client type as "external"

2015-10-22 Thread Fam Zheng
They will be excluded by type in the nested event loops in block layer, so that unwanted events won't be processed there. Signed-off-by: Fam Zheng Reviewed-by: Kevin Wolf --- hw/block/dataplane/virtio-blk.c | 5 ++--- hw/scsi/virtio-scsi-dataplane.c | 18

[Qemu-block] [PATCH v3 15/21] virtio-blk: Account for failed and invalid operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/block/virtio-blk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 8beb26b..aea9728 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -76,7 +76,7 @@

[Qemu-block] [PATCH v3 14/21] nvme: Account for failed and invalid operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/block/nvme.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 5da41b2..169e4fa 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -201,10 +201,11 @@ static void

[Qemu-block] [PATCH v6 00/12] block: Protect nested event loop with bdrv_drained_begin and bdrv_drained_end

2015-10-22 Thread Fam Zheng
v6: Add Kevin's rev-by in patches 1-3, 6-8, 10, 12. Add Jeff's rev-by in patches 1, 2, 6-8, 10. 04: Fix spelling and wording in comments. [Jeff] Add assert at decrement. [Jeff] 05: Fix bad rebase. [Jeff] 09: Let blk_is_available come first. [Jeff, Kevin] 11: Rewrite

[Qemu-block] [PATCH v6 04/12] aio: introduce aio_{disable, enable}_external

2015-10-22 Thread Fam Zheng
Signed-off-by: Fam Zheng --- aio-posix.c | 3 ++- aio-win32.c | 3 ++- include/block/aio.h | 38 ++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index f0f9122..0467f23 100644 ---

Re: [Qemu-block] [PATCH] block/nfs: add support for setting debug level

2015-10-22 Thread Peter Lieven
Am 22.09.2015 um 08:13 schrieb Peter Lieven: Am 25.06.2015 um 15:18 schrieb Stefan Hajnoczi: On Tue, Jun 23, 2015 at 10:12:15AM +0200, Peter Lieven wrote: upcoming libnfs versions will support logging debug messages. Add support for it in qemu through an URL parameter. Signed-off-by: Peter

[Qemu-block] [PATCH v3 06/21] block: Add statistics for failed and invalid I/O operations

2015-10-22 Thread Alberto Garcia
This patch adds the block_acct_failed() and block_acct_invalid() functions to allow keeping track of failed and invalid I/O operations. The number of failed and invalid operations is exposed in BlockDeviceStats. We don't keep track of the time spent on invalid operations because they are

[Qemu-block] [PATCH v3 02/21] ide: Account for write operations correctly

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia Reviewed-by: Stefan Hajnoczi --- hw/ide/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 317406d..b559f1b 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -895,7

[Qemu-block] [PATCH v3 05/21] block: Add idle_time_ns to BlockDeviceStats

2015-10-22 Thread Alberto Garcia
This patch adds the new field 'idle_time_ns' to the BlockDeviceStats structure, indicating the time that has passed since the previous I/O operation. It also adds the block_acct_idle_time_ns() call, to ensure that all references to the clock type used for accounting are in the same place. This

[Qemu-block] [PATCH v3 12/21] block: Use QEMU_CLOCK_VIRTUAL for the accounting code in qtest mode

2015-10-22 Thread Alberto Garcia
This patch switches to QEMU_CLOCK_VIRTUAL for the accounting code in qtest mode, and makes the latency of the operation constant. This way we can perform tests on the accounting code with reproducible results. Signed-off-by: Alberto Garcia --- block/accounting.c | 14

[Qemu-block] [PATCH v3 10/21] block: New option to define the intervals for collecting I/O statistics

2015-10-22 Thread Alberto Garcia
The BlockAcctStats structure contains a list of BlockAcctTimedStats. Each one of these collects statistics about the minimum, maximum and average latencies of all I/O operations in a certain interval of time. This patch adds a new "stats-intervals" option that allows defining these intervals.

[Qemu-block] [PATCH v3 03/21] block: define 'clock_type' for the accounting code

2015-10-22 Thread Alberto Garcia
Its value is still QEMU_CLOCK_REALTIME, but having it in a variable will allow us to change its value easily in the future when running in qtest mode. Signed-off-by: Alberto Garcia Reviewed-by: Stefan Hajnoczi --- block/accounting.c | 6 -- 1 file

[Qemu-block] [PATCH v3 13/21] iotests: Add test for the block device statistics

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- tests/qemu-iotests/136 | 349 + tests/qemu-iotests/136.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 355 insertions(+) create mode 100644 tests/qemu-iotests/136 create mode

[Qemu-block] [PATCH v3 19/21] macio: Account for failed operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/ide/macio.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 66ac2ba..176e331 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -286,7 +286,11 @@ static void

[Qemu-block] [PATCH v3 16/21] xen_disk: Account for failed and invalid operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/block/xen_disk.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 4869518..02eda6e 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@

Re: [Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Peter Lieven
Am 22.10.2015 um 10:17 schrieb Fam Zheng: Previously we return -EIO blindly when anything goes wrong. Add a helper function to parse sense fields and try to make the return code more meaningful. Signed-off-by: Fam Zheng --- block/iscsi.c | 56

Re: [Qemu-block] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Peter Lieven
Am 22.10.2015 um 10:17 schrieb Fam Zheng: When qcow2 is created on iscsi target with a virtual size greater than physical capacity of the LUN, over time it's possible that guest fills too much data and at that point, new clusters in qcow2 will be allocated beyond the end of disk. Why would you

[Qemu-block] [PATCH v6 12/12] tests: Add test case for aio_disable_external

2015-10-22 Thread Fam Zheng
Signed-off-by: Fam Zheng Reviewed-by: Kevin Wolf --- tests/test-aio.c | 24 1 file changed, 24 insertions(+) diff --git a/tests/test-aio.c b/tests/test-aio.c index 03cd45d..1623803 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c

[Qemu-block] [PATCH 2/2] qcow2: Translate -ERANGE to -ENOSPC

2015-10-22 Thread Fam Zheng
This will make the default werror (=enospc) work better when qcow2 is created on top of iscsi or other block devices. Signed-off-by: Fam Zheng --- block/qcow2.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index bacc4f2..8edf0fe 100644

[Qemu-block] [PATCH v3 07/21] block: Allow configuring whether to account failed and invalid ops

2015-10-22 Thread Alberto Garcia
This patch adds two options, "stats-account-invalid" and "stats-account-failed", that can be used to decide whether invalid and failed I/O operations must be used when collecting statistics for latency and last access time. Signed-off-by: Alberto Garcia Reviewed-by: Stefan

Re: [Qemu-block] [PATCH v6 09/12] block: Add "drained begin/end" for internal snapshot

2015-10-22 Thread Jeff Cody
On Thu, Oct 22, 2015 at 12:18:11PM +0200, Kevin Wolf wrote: > Am 22.10.2015 um 08:32 hat Fam Zheng geschrieben: > > This ensures the atomicity of the transaction by avoiding processing of > > external requests such as those from ioeventfd. > > > > state->bs is assigned right after

Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command

2015-10-22 Thread Alberto Garcia
On Thu 22 Oct 2015 12:38:24 PM CEST, Kevin Wolf wrote: >> >> > I haven't thought about it enough yet, but it seems to me that we >> >> > can't do the BDS/BB aliasing with blockdev-del, but need to interpret >> >> > node-name as BDS and id as BB. Perhaps we also shouldn't use a

Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 13:31 hat Alberto Garcia geschrieben: > On Thu 22 Oct 2015 01:25:05 PM CEST, Kevin Wolf wrote: > >> But there's this case that is not so obvious. It involves the new > >> 'blockdev-snapshot' command I'm working on: > >> > >> - blockdev-add id=drive0 node-name=node0

Re: [Qemu-block] [PATCH v6 11/12] qed: Implement .bdrv_drain

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 08:32 hat Fam Zheng geschrieben: > The "need_check_timer" is used to clear the "NEED_CHECK" flag in the > image header after a grace period once metadata update has finished. In > compliance to the bdrv_drain semantics we should make sure it remains > deleted once .bdrv_drain is

Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 13:08 hat Alberto Garcia geschrieben: > >> I'm currently thinking about d), which tries to maintain the symmetry > >> with blockdev-add: > >> > >> - blockdev-del would have two parameters, 'id' and 'node-name', and only > >> one of them can be set, so you must choose whether

Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command

2015-10-22 Thread Alberto Garcia
On Thu 22 Oct 2015 01:25:05 PM CEST, Kevin Wolf wrote: >> But there's this case that is not so obvious. It involves the new >> 'blockdev-snapshot' command I'm working on: >> >> - blockdev-add id=drive0 node-name=node0 file=hd0.qcow2 >> - qemu-img create -f qcow2 -b hd0.qcow2 overlay0.qcow2 >>

Re: [Qemu-block] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Fam Zheng
On Thu, 10/22 10:32, Peter Lieven wrote: > Am 22.10.2015 um 10:17 schrieb Fam Zheng: > >When qcow2 is created on iscsi target with a virtual size greater than > >physical > >capacity of the LUN, over time it's possible that guest fills too much data > >and > >at that point, new clusters in qcow2

Re: [Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Fam Zheng
On Thu, 10/22 10:45, Paolo Bonzini wrote: > > > On 22/10/2015 10:31, Peter Lieven wrote: > > > > +switch (sense->key) { > > +case SCSI_SENSE_NO_SENSE: > > +return 0; > > +break; > > +case SCSI_SENSE_NOT_READY: > > +return -EBUSY; > > +break; > > +

Re: [Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Paolo Bonzini
On 22/10/2015 11:51, Fam Zheng wrote: > > > > > > +switch (sense->key) { > > > +case SCSI_SENSE_NO_SENSE: > > > +return 0; > > > +break; > > > +case SCSI_SENSE_NOT_READY: > > > +return -EBUSY; > > > +break; > > > +case SCSI_SENSE_DATA_PROTECTION:

Re: [Qemu-block] [PATCH 0/2] Fix werror=enospc for qcow2 on iscsi

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 10:45 hat Paolo Bonzini geschrieben: > On 22/10/2015 10:17, Fam Zheng wrote: > > When qcow2 is created on iscsi target with a virtual size greater than > > physical > > capacity of the LUN, over time it's possible that guest fills too much data > > and > > at that point, new

Re: [Qemu-block] [PATCH v6 09/12] block: Add "drained begin/end" for internal snapshot

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 08:32 hat Fam Zheng geschrieben: > This ensures the atomicity of the transaction by avoiding processing of > external requests such as those from ioeventfd. > > state->bs is assigned right after bdrv_drained_begin. Because it was > used as the flag for deletion or not in abort,

Re: [Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Peter Lieven
Am 22.10.2015 um 10:45 schrieb Paolo Bonzini: On 22/10/2015 10:31, Peter Lieven wrote: +switch (sense->key) { +case SCSI_SENSE_NO_SENSE: +return 0; +break; Isn't it dangerous to return 0 (no error) if the status is != SCSI_STATUS_GOOD? Peter

Re: [Qemu-block] [PATCH 1/2] iscsi: Translate scsi sense into error code

2015-10-22 Thread Kevin Wolf
Am 22.10.2015 um 10:17 hat Fam Zheng geschrieben: > Previously we return -EIO blindly when anything goes wrong. Add a helper > function to parse sense fields and try to make the return code more > meaningful. > > Signed-off-by: Fam Zheng > --- > block/iscsi.c | 56

Re: [Qemu-block] [PATCH 0/3] Add 'blockdev-del' command

2015-10-22 Thread Kevin Wolf
Am 20.10.2015 um 17:02 hat Alberto Garcia geschrieben: > On Mon 19 Oct 2015 05:04:50 PM CEST, Kevin Wolf wrote: > >> > So we seem to have two criteria to distinguish BDSes: > >> > > >> > 1. Does/Doesn't have a BlockBackend on top. > >> >In the future, multiple BlockBackends

[Qemu-block] [PATCH v7 06/10] block: Add "drained begin/end" for transactional external snapshot

2015-10-22 Thread Fam Zheng
This ensures the atomicity of the transaction by avoiding processing of external requests such as those from ioeventfd. Signed-off-by: Fam Zheng Reviewed-by: Jeff Cody Reviewed-by: Kevin Wolf --- blockdev.c | 11 +-- 1 file changed,

[Qemu-block] [PATCH v10 15/25] block: Convert to new qapi union layout

2015-10-22 Thread Eric Blake
We have two issues with our qapi union layout: 1) Even though the QMP wire format spells the tag 'type', the C code spells it 'kind', requiring some hacks in the generator. 2) The C struct uses an anonymous union, which places all tag values in the same namespace as all non-variant members. This

[Qemu-block] [PATCH v7 10/10] tests: Add test case for aio_disable_external

2015-10-22 Thread Fam Zheng
Signed-off-by: Fam Zheng Reviewed-by: Kevin Wolf --- tests/test-aio.c | 24 1 file changed, 24 insertions(+) diff --git a/tests/test-aio.c b/tests/test-aio.c index 03cd45d..1623803 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c

[Qemu-block] [PATCH v7 04/10] aio: introduce aio_{disable, enable}_external

2015-10-22 Thread Fam Zheng
Signed-off-by: Fam Zheng --- aio-posix.c | 3 ++- aio-win32.c | 3 ++- include/block/aio.h | 38 ++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index f0f9122..0467f23 100644 ---

[Qemu-block] [PATCH v7 05/10] block: Introduce "drained begin/end" API

2015-10-22 Thread Fam Zheng
The semantics is that after bdrv_drained_begin(bs), bs will not get new external requests until the matching bdrv_drained_end(bs). Signed-off-by: Fam Zheng --- block/io.c| 17 + include/block/block.h | 19 +++

[Qemu-block] [PATCH v7 09/10] block: Add "drained begin/end" for internal snapshot

2015-10-22 Thread Fam Zheng
This ensures the atomicity of the transaction by avoiding processing of external requests such as those from ioeventfd. state->bs is assigned right after bdrv_drained_begin. Because it was used as the flag for deletion or not in abort, now we need a separate flag - InternalSnapshotState.created.

[Qemu-block] [PATCH v7 08/10] block: Add "drained begin/end" for transactional blockdev-backup

2015-10-22 Thread Fam Zheng
Similar to the previous patch, make sure that external events are not dispatched during transaction operations. Signed-off-by: Fam Zheng Reviewed-by: Jeff Cody Reviewed-by: Kevin Wolf --- blockdev.c | 9 - 1 file changed, 8

[Qemu-block] [PATCH v7 00/10] block: Protect nested event loop with bdrv_drained_begin and bdrv_drained_end

2015-10-22 Thread Fam Zheng
v7: Exclude bdrv_drain and bdrv_qed_drain patches, they'll follow the bdrv_drain fix for bdrv_aio_flush. Fix internal snapshot clean. v6: Add Kevin's rev-by in patches 1-3, 6-8, 10, 12. Add Jeff's rev-by in patches 1, 2, 6-8, 10. 04: Fix spelling and wording in comments. [Jeff]

[Qemu-block] [PATCH v7 07/10] block: Add "drained begin/end" for transactional backup

2015-10-22 Thread Fam Zheng
This ensures the atomicity of the transaction by avoiding processing of external requests such as those from ioeventfd. Move the assignment to state->bs up right after bdrv_drained_begin, so that we can use it in the clean callback. The abort callback will still check bs->job and state->job, so

[Qemu-block] [PATCH v7 02/10] nbd: Mark fd handlers client type as "external"

2015-10-22 Thread Fam Zheng
So we could distinguish it from internal used fds, thus avoid handling unwanted events in nested aio polls. Signed-off-by: Fam Zheng Reviewed-by: Jeff Cody Reviewed-by: Kevin Wolf --- nbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[Qemu-block] [PATCH v7 01/10] aio: Add "is_external" flag for event handlers

2015-10-22 Thread Fam Zheng
All callers pass in false, and the real external ones will switch to true in coming patches. Signed-off-by: Fam Zheng Reviewed-by: Jeff Cody Reviewed-by: Kevin Wolf --- aio-posix.c | 6 - aio-win32.c

Re: [Qemu-block] [PATCH v6 11/12] qed: Implement .bdrv_drain

2015-10-22 Thread Fam Zheng
On Thu, 10/22 22:59, Paolo Bonzini wrote: > > > On 22/10/2015 12:53, Kevin Wolf wrote: > > Am 22.10.2015 um 08:32 hat Fam Zheng geschrieben: > >> The "need_check_timer" is used to clear the "NEED_CHECK" flag in the > >> image header after a grace period once metadata update has finished. In > >>

[Qemu-block] [PATCH v2 0/5] Add 'x-blockdev-del' command

2015-10-22 Thread Alberto Garcia
Here's the new version of the blockdev-del command. The first change is that I renamed it to 'x-blockdev-del' as Markus suggested. I also extended the test cases, which should be way more robust now. This actually made me realize that there's tricky scenarios that require changes in other parts

[Qemu-block] [PATCH v2 3/5] block: Add blk_get_refcnt()

2015-10-22 Thread Alberto Garcia
This function returns the reference count of a given BlockBackend. For convenience, it returns 0 if the BlockBackend pointer is NULL. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/block-backend.c | 5 +

[Qemu-block] [PATCH v2 2/5] backup: keep an extra reference to the target image during the job

2015-10-22 Thread Alberto Garcia
During the 'drive-backup' operation the target image only has the monitor reference, therefore there's nothing that prevents its deletion using the 'x-blockdev-del' command before the block job has finished. Although the operation itself does not allow the user to set a node name that can be used

[Qemu-block] [PATCH v3 18/21] ide: Account for failed and invalid operations

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- hw/ide/core.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index b559f1b..dd7e9c5 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -574,7 +574,6 @@ static void

[Qemu-block] [PATCH v3 08/21] block: Compute minimum, maximum and average I/O latencies

2015-10-22 Thread Alberto Garcia
This patch keeps track of the minimum, maximum and average latencies of I/O operations during a certain interval of time. The values are exposed in the BlockDeviceTimedStats structure. An option to define the intervals to collect these statistics will be added in a separate patch.

[Qemu-block] [PATCH v2 4/5] block: Add 'x-blockdev-del' QMP command

2015-10-22 Thread Alberto Garcia
This command is still experimental, hence the name. This is the companion to 'blockdev-add'. It allows deleting a BlockBackend with its associated BlockDriverState tree, or a BlockDriverState that is not attached to any backend. In either case, the command fails if the reference count is greater

[Qemu-block] [PATCH v2 1/5] mirror: keep an extra reference to the target image during the job

2015-10-22 Thread Alberto Garcia
During the 'drive-mirror' operation the target image only has the monitor reference, therefore there's nothing that prevents its deletion using the 'x-blockdev-del' command before the block job has finished. Signed-off-by: Alberto Garcia --- block/mirror.c | 6 ++ 1 file

[Qemu-block] [PATCH v2 5/5] iotests: Add tests for the x-blockdev-del command

2015-10-22 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- tests/qemu-iotests/139 | 408 + tests/qemu-iotests/139.out | 5 + tests/qemu-iotests/group | 1 + 3 files changed, 414 insertions(+) create mode 100644 tests/qemu-iotests/139 create mode

Re: [Qemu-block] [PATCH 1/4] ide/atapi: make PIO read requests async

2015-10-22 Thread Stefan Hajnoczi
On Mon, Oct 12, 2015 at 02:27:22PM +0200, Peter Lieven wrote: > @@ -129,9 +134,71 @@ static int cd_read_sector(IDEState *s, int lba, uint8_t > *buf, int sector_size) > ret = -EIO; > break; > } > + > +if (!ret) { > +s->lba++; This function probably shouldn't

Re: [Qemu-block] [PATCH v2 1/5] mirror: keep an extra reference to the target image during the job

2015-10-22 Thread Alberto Garcia
On Thu 22 Oct 2015 05:13:55 PM CEST, Alberto Garcia wrote: > During the 'drive-mirror' operation the target image only has the > monitor reference, therefore there's nothing that prevents its > deletion using the 'x-blockdev-del' command before the block job has > finished. Answering myself: it's