Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/4] fdc: Add a floppy qbus

2016-10-14 Thread John Snow
On 09/30/2016 03:39 PM, Kevin Wolf wrote: This adds a qbus to the floppy controller that should contain the floppy drives eventually. At the moment it just exists and is empty. Not unlike myself. Signed-off-by: Kevin Wolf --- hw/block/fdc.c | 40

Re: [Qemu-block] [Qemu-devel] [PATCHv2 0/2] dma-helpers: explicitly pass alignment into DMA helpers

2016-10-14 Thread John Snow
On 10/14/2016 07:41 AM, Mark Cave-Ayland wrote: This is a follow-up to the thread at https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01396.html which introduces an explicit alignment to the DMA helpers to facilitate conversion of the macio controller over to use the now byte-aligned

Re: [Qemu-block] [PATCH v4 06/12] block/nbd: Accept SocketAddress

2016-10-14 Thread Ashijeet Acharya
On Thu, Oct 13, 2016 at 5:12 PM, Kevin Wolf wrote: > Am 28.09.2016 um 22:55 hat Max Reitz geschrieben: >> Add a new option "address" to the NBD block driver which accepts a >> SocketAddress. >> >> "path", "host" and "port" are still supported as legacy options and are >> mapped

Re: [Qemu-block] [PATCH 06/18] qed: Implement .bdrv_drain

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > From: Fam Zheng > > 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. To > comply with the bdrv_drain semantics, we should make sure it remains >

Re: [Qemu-block] [PATCH 07/18] block: introduce bdrv_poll_while and bdrv_wakeup

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > We want the BDS event loop to run exclusively in the iothread that > owns the BDS's AioContext. This function and macro provides the > synchronization between the two event loops. > > Signed-off-by: Paolo Bonzini > --- >

Re: [Qemu-block] [PATCH 07/18] block: introduce bdrv_poll_while and bdrv_wakeup

2016-10-14 Thread Paolo Bonzini
On 14/10/2016 12:42, Fam Zheng wrote: >> > diff --git a/block/qed.c b/block/qed.c >> > index 1a7ef0a..dcb5fb9 100644 >> > --- a/block/qed.c >> > +++ b/block/qed.c >> > @@ -354,7 +354,9 @@ static void qed_start_need_check_timer(BDRVQEDState *s) >> > static void

Re: [Qemu-block] [PATCH 03/18] mirror: use bdrv_drained_begin/bdrv_drained_end

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > Ensure that there are no changes between the last check to > bdrv_get_dirty_count and the switch to the target. > > There is already a bdrv_drained_end call, we only need to ensure > that bdrv_drained_begin is not called twice. > > Cc:

Re: [Qemu-block] [PATCH 05/18] block: change drain to look only at one child at a time

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > bdrv_requests_pending is checking children to also wait until internal > requests (such as metadata writes) have completed. However, checking > children is in general overkill. Children requests can be of two kinds: > > - requests caused by an

Re: [Qemu-block] [PATCH 03/18] mirror: use bdrv_drained_begin/bdrv_drained_end

2016-10-14 Thread Paolo Bonzini
On 14/10/2016 11:43, Fam Zheng wrote: > On Thu, 10/13 19:34, Paolo Bonzini wrote: >> Ensure that there are no changes between the last check to >> bdrv_get_dirty_count and the switch to the target. >> >> There is already a bdrv_drained_end call, we only need to ensure >> that bdrv_drained_begin

Re: [Qemu-block] [PATCH 06/18] qed: Implement .bdrv_drain

2016-10-14 Thread Paolo Bonzini
On 14/10/2016 12:33, Fam Zheng wrote: >> > +bdrv_aio_flush(s->bs->file->bs, qed_clear_need_check, s); > If this one has to change, what about the other bdrv_aio_flush(s->bs, ...) > down > in this call path: > > qed_need_check_timer_cb > qed_clear_need_check >

Re: [Qemu-block] [PATCH] rbd: make the code better readable

2016-10-14 Thread 李秀波
JohnSnow 写到: > > >On 10/14/2016 05:51 AM, Xiubo Li wrote: >> Make it a bit clear and better readable. >> > >Suggestion: "Make it clearer and more readable." > Yes, see the next version. >> >> if (qemu_rbd_set_auth(cluster, secretid, errp) < 0) { >>

Re: [Qemu-block] [Qemu-devel] [PATCH v2 2/4] fdc: Add a floppy drive qdev

2016-10-14 Thread John Snow
On 09/30/2016 03:39 PM, Kevin Wolf wrote: Floppy controllers automatically create two floppy drive devices in qdev now. (They always created two drives, but managed them only internally.) Is this commit message out-of-phase now? Signed-off-by: Kevin Wolf ---

[Qemu-block] [PATCH v11 09/19] block: Support streaming to an intermediate layer

2016-10-14 Thread Alberto Garcia
This makes sure that the image we are streaming into is open in read-write mode during the operation. Operation blockers are also set in all intermediate nodes, since they will be removed from the chain afterwards. Finally, this also unblocks the stream operation in backing files.

[Qemu-block] [PATCH v11 07/19] block: Block all nodes involved in the block-commit operation

2016-10-14 Thread Alberto Garcia
After a successful block-commit operation all nodes between top and base are removed from the backing chain, and top's overlay needs to be updated to point to base. Because of that we should prevent other block jobs from messing with them. This patch blocks all operations in these nodes in

[Qemu-block] [PATCH v11 16/19] qemu-iotests: Add iotests.supports_quorum()

2016-10-14 Thread Alberto Garcia
There's many tests that need Quorum support in order to run. At the moment each test implements its own check to see if Quorum is enabled. This patch centralizes all those checks in a new function called iotests.supports_quorum(). Signed-off-by: Alberto Garcia ---

[Qemu-block] [PATCH v11 11/19] docs: Document how to stream to an intermediate layer

2016-10-14 Thread Alberto Garcia
Signed-off-by: Alberto Garcia --- docs/live-block-ops.txt | 36 +--- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/docs/live-block-ops.txt b/docs/live-block-ops.txt index a257087..2211d14 100644 --- a/docs/live-block-ops.txt +++

[Qemu-block] [PATCH v11 00/19] Support streaming to an intermediate layer

2016-10-14 Thread Alberto Garcia
Hi all, here's version 11 of the series. See below for the list of changes. The most important one is, I think, the addition of the 'base-node' parameter to 'block-stream'. I decided to go for this one rather than writing a new 'blockdev-stream' command because (a) it's not obvious to me that

[Qemu-block] [PATCH v11 03/19] block: Add block_job_add_bdrv()

2016-10-14 Thread Alberto Garcia
When a block job is created on a certain BlockDriverState, operations are blocked there while the job exists. However, some block jobs may involve additional BDSs, which must be blocked separately when the job is created and unblocked manually afterwards. This patch adds block_job_add_bdrv(),

Re: [Qemu-block] [PATCH 1/7] blockjobs: hide internal jobs from management API

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:56 hat John Snow geschrieben: > If jobs are not created directly by the user, do not allow them to be > seen by the user/management utility. At the moment, 'internal' jobs are > those that do not have an ID. As of this patch it is impossible to > create such jobs. > >

[Qemu-block] [PATCH v11 01/19] block: Add bdrv_drain_all_{begin, end}()

2016-10-14 Thread Alberto Garcia
bdrv_drain_all() doesn't allow the caller to do anything after all pending requests have been completed but before block jobs are resumed. This patch splits bdrv_drain_all() into _begin() and _end() for that purpose. It also adds aio_{disable,enable}_external() calls to disable external clients

[Qemu-block] [PATCH v11 02/19] block: Pause all jobs during bdrv_reopen_multiple()

2016-10-14 Thread Alberto Garcia
When a BlockDriverState is about to be reopened it can trigger certain operations that need to write to disk. During this process a different block job can be woken up. If that block job completes and also needs to call bdrv_reopen() it can happen that it needs to do it on the same

[Qemu-block] [PATCH v11 05/19] block: Use block_job_add_bdrv() in backup_start()

2016-10-14 Thread Alberto Garcia
Use block_job_add_bdrv() instead of blocking all operations in backup_start() and unblocking them in backup_run(). Signed-off-by: Alberto Garcia --- block/backup.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block/backup.c b/block/backup.c index

[Qemu-block] [PATCH v11 06/19] block: Check blockers in all nodes involved in a block-commit job

2016-10-14 Thread Alberto Garcia
qmp_block_commit() checks for op blockers in the active and destination (base) images. However all nodes between top_bs and base are also involved, and they are removed from the chain afterwards. In addition to that, if top_bs is not the active layer then top_bs's overlay also needs to be checked

[Qemu-block] [PATCH v11 14/19] qemu-iotests: Test overlapping stream and commit operations

2016-10-14 Thread Alberto Garcia
These test cases check that it's not possible to perform two block-stream or block-commit operations if there are nodes involved in both. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 89 ++

[Qemu-block] [PATCH v11 18/19] block: Add 'base-node' parameter to the 'block-stream' command

2016-10-14 Thread Alberto Garcia
The way to specify the node from which to copy data in the block-stream operation is by using the 'base' parameter. This parameter however takes a file name, not a node name. Since we want to be able to perform this operation using only node names, this patch adds a new 'base-node' parameter.

[Qemu-block] [PATCH v11 04/19] block: Use block_job_add_bdrv() in mirror_start_job()

2016-10-14 Thread Alberto Garcia
Use block_job_add_bdrv() instead of blocking all operations in mirror_start_job() and unblocking them in mirror_exit(). Signed-off-by: Alberto Garcia --- block/mirror.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index

[Qemu-block] [PATCH v11 08/19] block: Block all intermediate nodes in commit_active_start()

2016-10-14 Thread Alberto Garcia
When block-commit is launched without the top parameter, it uses internally a mirror block job. In that case all intermediate nodes between the active and base nodes must be blocked as well. Signed-off-by: Alberto Garcia Reviewed-by: Kevin Wolf ---

[Qemu-block] [PATCH v11 15/19] qemu-iotests: Test block-stream and block-commit in parallel

2016-10-14 Thread Alberto Garcia
As with test_stream_parallel(), we allow mixing block-stream and block-commit operations in the same backing chain as long as there's no overlap among the involved nodes. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 30 ++

[Qemu-block] [PATCH v11 19/19] qemu-iotests: Test the 'base-node' parameter of 'block-stream'

2016-10-14 Thread Alberto Garcia
The block-stream command has traditionally used the 'base' parameter to indicate the image to copy the data from. This test checks that the 'base-node' parameter can also be used for the same purpose. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 33

[Qemu-block] [PATCH v11 17/19] qemu-iotests: Test streaming to a Quorum child

2016-10-14 Thread Alberto Garcia
Quorum children are special in the sense that they're not directly attached to a block backend but they're not used as backing images either. However the intermediate block streaming code supports streaming to them. This is a test case for that scenario. Signed-off-by: Alberto Garcia

Re: [Qemu-block] [PATCH v5 1/1] block: improve error handling in raw_open

2016-10-14 Thread Stefan Hajnoczi
On Tue, Oct 11, 2016 at 04:12:35PM +0200, Halil Pasic wrote: > Make raw_open for POSIX more consistent in handling errors by setting > the error object also when qemu_open fails. The error object was set > generally set in case of errors, but I guess this case was overlooked. > Do the same for

Re: [Qemu-block] [PATCH v2 0/4] fdc: Use separate qdev device for drives

2016-10-14 Thread Kevin Wolf
Am 30.09.2016 um 21:39 hat Kevin Wolf geschrieben: > We have been complaining for a long time about how the floppy controller and > floppy drives are combined in a single qdev device and how this makes the > device awkward to work with because it behaves different from all other block > devices. >

[Qemu-block] [PATCHv2 1/2] dma-helpers: explicitly pass alignment into DMA helpers

2016-10-14 Thread Mark Cave-Ayland
The hard-coded default alignment is BDRV_SECTOR_SIZE, however this is not necessarily the case for all platforms. Use this as the default alignment for all current callers. Signed-off-by: Mark Cave-Ayland Reviewed-by: Eric Blake Acked-by: John

[Qemu-block] [PATCHv2 2/2] macio: switch over to new byte-aligned DMA helpers

2016-10-14 Thread Mark Cave-Ayland
Now that the DMA helpers are byte-aligned they can be called directly from the macio routines rather than emulating byte-aligned accesses via multiple block-level accesses. Signed-off-by: Mark Cave-Ayland Reviewed-by: Eric Blake Reviewed-by:

[Qemu-block] [PATCHv2 0/2] dma-helpers: explicitly pass alignment into DMA helpers

2016-10-14 Thread Mark Cave-Ayland
This is a follow-up to the thread at https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01396.html which introduces an explicit alignment to the DMA helpers to facilitate conversion of the macio controller over to use the now byte-aligned DMA helpers. Patch 1 introduces an alignment

[Qemu-block] [PATCH v11 10/19] block: Add QMP support for streaming to an intermediate layer

2016-10-14 Thread Alberto Garcia
This patch makes the 'device' parameter of the 'block-stream' command accept a node name that is not a root node. In addition to that, operation blockers will be checked in all intermediate nodes between the top and the base node. Signed-off-by: Alberto Garcia --- blockdev.c

Re: [Qemu-block] [PATCH 4/7] blockjob: centralize QMP event emissions

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:56 hat John Snow geschrieben: > There's no reason to leave this to blockdev; we can do it in blockjobs > directly and get rid of an extra callback for most users. > > All non-internal events, even those created outside of QMP, will > consistently emit events. > >

Re: [Qemu-block] [PATCH 6/7] blockjobs: split interface into public/private, Part 1

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:57 hat John Snow geschrieben: > To make it a little more obvious which functions are intended to be > public interface and which are intended to be for use only by jobs > themselves, split the interface into "public" and "private" files. > > Convert blockjobs (e.g.

Re: [Qemu-block] block/nfs: Fine grained runtime options in nfs

2016-10-14 Thread Stefan Hajnoczi
On Mon, Oct 10, 2016 at 10:39:30AM +0530, Ashijeet Acharya wrote: > Hi all, > > I was working on trying to add blockdev-add compatibility for the nfs > block driver but before that runtime options need to be separated into > various options rather than just a simple "filename" option. > > I have

Re: [Qemu-block] [PATCH 15/18] block: only call aio_poll on the current thread's AioContext

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > diff --git a/include/block/block_int.h b/include/block/block_int.h > index 11f877b..0516f62 100644 > --- a/include/block/block_int.h > +++ b/include/block/block_int.h > @@ -470,6 +470,7 @@ struct BlockDriverState { > NotifierWithReturnList

Re: [Qemu-block] [PATCH 12/18] iothread: detach all block devices before stopping them

2016-10-14 Thread Fam Zheng
On Thu, 10/13 19:34, Paolo Bonzini wrote: > Soon bdrv_drain will not call aio_poll itself on iothreads. If block > devices are left hanging off the iothread's AioContext, there will be no > one to do I/O for those poor devices. > > Signed-off-by: Paolo Bonzini > --- >

Re: [Qemu-block] [PATCH 0/2] quorum: cleanup and optimization for FIFO case

2016-10-14 Thread Stefan Hajnoczi
On Wed, Oct 05, 2016 at 06:35:25PM +0200, Paolo Bonzini wrote: > A couple patches I had lying in the huge multiqueue series but are > not really related. So let's flush 'em... > > Paolo Bonzini (2): > quorum: change child_iter to children_read > quorum: do not allocate multiple iovecs for

Re: [Qemu-block] [PATCH 3/7] Replication/Blockjobs: Create replication jobs as internal

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:56 hat John Snow geschrieben: > Bubble up the internal interface to commit and backup jobs, then switch > replication tasks over to using this methodology. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH 2/7] blockjobs: Allow creating internal jobs

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:56 hat John Snow geschrieben: > Add the ability to create jobs without an ID. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

[Qemu-block] [PATCH] rbd: make the code better readable

2016-10-14 Thread Xiubo Li
Make it a bit clear and better readable. Signed-off-by: Xiubo Li --- block/rbd.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 0a5840d..de8ca1b 100644 --- a/block/rbd.c +++

[Qemu-block] bug introduced by "block: Move throttling fields from BDS to BB"

2016-10-14 Thread Paolo Bonzini
Here is next_throttle_token: -ThrottleGroup *tg = container_of(blk_bs(blk)->throttle_state, - ThrottleGroup, ts); +BlockBackendPublic *blkp = blk_get_public(blk); +ThrottleGroup *tg = container_of(blkp->throttle_state, ThrottleGroup, ts);

Re: [Qemu-block] [PATCH 12/18] iothread: detach all block devices before stopping them

2016-10-14 Thread Paolo Bonzini
On 14/10/2016 16:50, Fam Zheng wrote: >> > +BdrvNextIterator it; >> > + >> > +for (bs = bdrv_first(); bs; bs = bdrv_next()) { >> > +AioContext *ctx = bdrv_get_aio_context(bs); > I have a strong feeling that we should 'continue' if ctx == > qemu_get_aio_context() - otherwise a lot

Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/4] fdc: Move qdev properties to FloppyDrive

2016-10-14 Thread John Snow
On 09/30/2016 03:39 PM, Kevin Wolf wrote: This makes the FloppyDrive qdev object actually useful: Now that it has all properties that don't belong to the controller, you can actually use '-device floppy' and get a working result. Command line semantics is consistent with CD-ROM drives: By

Re: [Qemu-block] [Qemu-devel] [PATCH 1/7] blockjobs: hide internal jobs from management API

2016-10-14 Thread John Snow
On 10/14/2016 08:58 AM, Kevin Wolf wrote: Am 14.10.2016 um 00:56 hat John Snow geschrieben: If jobs are not created directly by the user, do not allow them to be seen by the user/management utility. At the moment, 'internal' jobs are those that do not have an ID. As of this patch it is

Re: [Qemu-block] [PATCH v5 1/1] block: improve error handling in raw_open

2016-10-14 Thread Halil Pasic
On 10/14/2016 05:59 PM, Stefan Hajnoczi wrote: > On Tue, Oct 11, 2016 at 04:12:35PM +0200, Halil Pasic wrote: >> > Make raw_open for POSIX more consistent in handling errors by setting >> > the error object also when qemu_open fails. The error object was set >> > generally set in case of errors,

Re: [Qemu-block] [PATCH 7/7] blockjobs: fix documentation

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:57 hat John Snow geschrieben: > (Trivial) > > Fix wrong function names in documentation. > > Signed-off-by: John Snow Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH 5/7] Blockjobs: Internalize user_pause logic

2016-10-14 Thread Kevin Wolf
Am 14.10.2016 um 00:57 hat John Snow geschrieben: > BlockJobs will begin hiding their state in preparation for some > refactorings anyway, so let's internalize the user_pause mechanism > instead of leaving it to callers to correctly manage. > > Signed-off-by: John Snow

Re: [Qemu-block] [Qemu-devel][PATCH] qemu-img: fix failed qemu-img command return zero exit code defeat

2016-10-14 Thread Stefan Hajnoczi
On Mon, Oct 10, 2016 at 11:07:09AM +0800, Xu Tian wrote: > If backing file can not open when do image rebase, flag 'ret' not > assign a non-zero value, then qemu-img process exit with code zero. > Assign value '-1' to flag 'ret' after report error message to fix > this defeat. I suggest rewording

Re: [Qemu-block] [PATCH] hw/block/nvme: Simplify if-statements a little bit

2016-10-14 Thread Stefan Hajnoczi
On Wed, Oct 12, 2016 at 05:18:40PM +0200, Thomas Huth wrote: > The condition '!A || (A && B)' is equivalent to '!A || B'. > > Buglink: https://bugs.launchpad.net/qemu/+bug/1464611 > Signed-off-by: Thomas Huth > --- > hw/block/nvme.c | 4 ++-- > 1 file changed, 2

[Qemu-block] [PATCH v11 13/19] qemu-iotests: Test block-stream operations in parallel

2016-10-14 Thread Alberto Garcia
This test case checks that it's possible to launch several stream operations in parallel in the same snapshot chain, each one involving a different set of nodes. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 80 ++

[Qemu-block] [PATCH v11 12/19] qemu-iotests: Test streaming to an intermediate layer

2016-10-14 Thread Alberto Garcia
This adds test_stream_intermediate(), similar to test_stream() but streams to the intermediate image instead. It also removes the usage of blkdebug, which is unnecessary for this test. Signed-off-by: Alberto Garcia --- tests/qemu-iotests/030 | 21 -

[Qemu-block] [PATCH v7 15/16] nbd: Implement NBD_CMD_WRITE_ZEROES on server

2016-10-14 Thread Eric Blake
Upstream NBD protocol recently added the ability to efficiently write zeroes without having to send the zeroes over the wire, along with a flag to control whether the client wants to allow a hole. Note that when it comes to requiring full allocation, vs. permitting optimizations, the NBD spec

Re: [Qemu-block] [PATCH 07/22] qcow2-bitmap: introduce auto-loading bitmaps

2016-10-14 Thread Vladimir Sementsov-Ogievskiy
On 01.10.2016 19:26, Max Reitz wrote: On 30.09.2016 12:53, Vladimir Sementsov-Ogievskiy wrote: Auto loading bitmaps are bitmaps in Qcow2, with AUTO flag set. They are ... +goto fail; +} + +/* loop is safe because next entry offset is calculated after conversion to Should it

[Qemu-block] [PATCH v7 11/16] nbd: Less allocation during NBD_OPT_LIST

2016-10-14 Thread Eric Blake
Since we know that the maximum name we are willing to accept is small enough to stack-allocate, rework the iteration over NBD_OPT_LIST responses to reuse a stack buffer rather than allocating every time. Furthermore, we don't even have to allocate if we know the server's length doesn't match what

[Qemu-block] [PATCH v7 01/16] nbd: Add qemu-nbd -D for human-readable description

2016-10-14 Thread Eric Blake
The NBD protocol allows servers to advertise a human-readable description alongside an export name during NBD_OPT_LIST. Add an option to pass through the user's string to the NBD client. Doing this also makes it easier to test commit 200650d4, which is the client counterpart of receiving the

[Qemu-block] [PATCH v7 08/16] nbd: Share common option-sending code in client

2016-10-14 Thread Eric Blake
Rather than open-coding each option request, it's easier to have common helper functions do the work. That in turn requires having convenient packed types for handling option requests and replies. Signed-off-by: Eric Blake --- v6: comment and formatting tweaks v5: no change

[Qemu-block] [PATCH v7 06/16] nbd: Share common reply-sending code in server

2016-10-14 Thread Eric Blake
Rather than open-coding NBD_REP_SERVER, reuse the code we already have by adding a length parameter. Additionally, the refactoring will make adding NBD_OPT_GO in a later patch easier. Signed-off-by: Eric Blake --- v6: improve (and add) function comments v5: no change v4: no

[Qemu-block] [PATCH v7 05/16] nbd: Rename struct nbd_request and nbd_reply

2016-10-14 Thread Eric Blake
Our coding convention prefers CamelCase names, and we already have other existing structs with NBDFoo naming. Let's be consistent, before later patches add even more structs. Signed-off-by: Eric Blake --- v6: new patch --- block/nbd-client.h | 2 +- include/block/nbd.h |

[Qemu-block] [PATCH v7 09/16] nbd: Let server know when client gives up negotiation

2016-10-14 Thread Eric Blake
The NBD spec says that a client should send NBD_OPT_ABORT rather than just dropping the connection, if the client doesn't like something the server sent during option negotiation. This is a best-effort attempt only, and can only be done in places where we know the server is still in sync with

[Qemu-block] [PATCH v7 04/16] nbd: Rename NbdClientSession to NBDClientSession

2016-10-14 Thread Eric Blake
It's better to use consistent capitalization of the namespace used for NBD functions; we have more instances of NBD* than Nbd*. Signed-off-by: Eric Blake --- v6: new patch --- block/nbd-client.h | 6 +++--- block/nbd-client.c | 26 +- block/nbd.c

[Qemu-block] [PATCH v7 00/16] nbd: efficient write zeroes

2016-10-14 Thread Eric Blake
Also available as a tag at: git fetch git://repo.or.cz/qemu/ericb.git nbd-zero-v7 v5 was here, but missed 2.7 freeze: https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg04053.html Since then, I've rebased the series, and the bulk of the changes were to use consistent NBDFoo CamelCase

[Qemu-block] [PATCH v7 02/16] nbd: Treat flags vs. command type as separate fields

2016-10-14 Thread Eric Blake
Current upstream NBD documents that requests have a 16-bit flags, followed by a 16-bit type integer; although older versions mentioned only a 32-bit field with masking to find flags. Since the protocol is in network order (big-endian over the wire), the ABI is unchanged; but dealing with the

[Qemu-block] [PATCH v7 03/16] nbd: Rename NBDRequest to NBDRequestData

2016-10-14 Thread Eric Blake
We have both 'struct NBDRequest' and 'struct nbd_request'; making it confusing to see which does what. Furthermore, we want to rename nbd_request to align with our normal CamelCase naming conventions. So, rename the struct which is used to associate the data received during request callbacks,

[Qemu-block] [PATCH v7 07/16] nbd: Send message along with server NBD_REP_ERR errors

2016-10-14 Thread Eric Blake
The NBD Protocol allows us to send human-readable messages along with any NBD_REP_ERR error during option negotiation; make use of this fact for clients that know what to do with our message. Signed-off-by: Eric Blake --- v6: tweak comments, fix indentation v5: don't leak

[Qemu-block] [PATCH v7 10/16] nbd: Let client skip portions of server reply

2016-10-14 Thread Eric Blake
The server has a nice helper function nbd_negotiate_drop_sync() which lets it easily ignore fluff from the client (such as the payload to an unknown option request). We can't quite make it common, since it depends on nbd_negotiate_read() which handles coroutine magic, but we can copy the idea

Re: [Qemu-block] [PATCH 0/7] blockjobs: preliminary refactoring work, Pt 1

2016-10-14 Thread John Snow
On 10/13/2016 06:56 PM, John Snow wrote: This is a follow-up to patches 1-6 of: [PATCH v2 00/11] blockjobs: Fix transactional race condition That series started trying to refactor blockjobs with the goal of internalizing BlockJob state as a side effect of having gone through the effort of

[Qemu-block] [PATCH v7 16/16] nbd: Implement NBD_CMD_WRITE_ZEROES on client

2016-10-14 Thread Eric Blake
Upstream NBD protocol recently added the ability to efficiently write zeroes without having to send the zeroes over the wire, along with a flag to control whether the client wants a hole. The generic block code takes care of falling back to the obvious write of lots of zeroes if we return

[Qemu-block] [PATCH v7 14/16] nbd: Improve server handling of shutdown requests

2016-10-14 Thread Eric Blake
NBD commit 6d34500b clarified how clients and servers are supposed to behave before closing a connection. It added NBD_REP_ERR_SHUTDOWN (for the server to announce it is about to go away during option haggling, so the client should quit sending NBD_OPT_* other than NBD_OPT_ABORT) and ESHUTDOWN

[Qemu-block] [PATCH v7 12/16] nbd: Support shorter handshake

2016-10-14 Thread Eric Blake
The NBD Protocol allows the server and client to mutually agree on a shorter handshake (omit the 124 bytes of reserved 0), via the server advertising NBD_FLAG_NO_ZEROES and the client acknowledging with NBD_FLAG_C_NO_ZEROES (only possible in newstyle, whether or not it is fixed newstyle). It

Re: [Qemu-block] [PATCH] rbd: make the code better readable

2016-10-14 Thread John Snow
On 10/14/2016 05:51 AM, Xiubo Li wrote: Make it a bit clear and better readable. Suggestion: "Make it clearer and more readable." Signed-off-by: Xiubo Li --- block/rbd.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff

Re: [Qemu-block] bug introduced by "block: Move throttling fields from BDS to BB"

2016-10-14 Thread Paolo Bonzini
On 14/10/2016 16:11, Paolo Bonzini wrote: > -ThrottleGroup *tg = container_of(blk_bs(blk)->throttle_state, > - ThrottleGroup, ts); > +BlockBackendPublic *blkp = blk_get_public(blk); > +ThrottleGroup *tg = container_of(blkp->throttle_state,