[Qemu-block] [PATCH 0/2] block: Expose host block dev I/O size limit in scsi-block/scsi-generic

2016-05-25 Thread Fam Zheng
Host devices passed through as scsi-block or scsi-generic may have a compound maximum I/O limit (out of physical hardware limit, driver quirks and file system configuration, etc) that is presented in the sysfs entry. SG_IOs we issue should respect this. However the value is currently not discoverab

[Qemu-block] [PATCH 1/2] raw-posix: Fetch max sectors for host block device from sysfs

2016-05-25 Thread Fam Zheng
This is sometimes a useful value we should count in. Signed-off-by: Fam Zheng --- block/raw-posix.c | 47 +++ 1 file changed, 47 insertions(+) diff --git a/block/raw-posix.c b/block/raw-posix.c index a4f5a1b..d3796ad 100644 --- a/block/raw-posix.c +++

[Qemu-block] [PATCH 2/2] scsi-generic: Merge block max xfer len in INQUIRY response

2016-05-25 Thread Fam Zheng
The rationale is similar to the above mode sense response interception: this is practically the only channel to communicate restraints from elsewhere such as host and block driver. The scsi bus we attach onto can have a larger max xfer len than what is accepted by the host file system (guarding be

[Qemu-block] [PATCH v3 1/5] block: split write_zeroes always

2016-05-25 Thread Eric Blake
From: "Denis V. Lunev" We should split requests even if they are less than write_zeroes_alignment. For example we can have the following request: offset 62k size 4k write_zeroes_alignment 64k The original code sent 1 request covering 2 qcow2 clusters, and resulted in both clusters being a

[Qemu-block] [PATCH v3 4/5] qemu-iotests: Test one more spot for optimizing write_zeroes

2016-05-25 Thread Eric Blake
Add another test to 154, showing that we currently allocate a data cluster in the top layer if any sector of the backing file was allocated. The next patch will optimize this case. Signed-off-by: Eric Blake --- tests/qemu-iotests/154 | 40 tests/qemu

[Qemu-block] [PATCH v3 2/5] qcow2: simplify logic in qcow2_co_write_zeroes

2016-05-25 Thread Eric Blake
From: "Denis V. Lunev" Unaligned requests will occupy only one cluster. This is true since the previous commit. Simplify the code taking this consideration into account. In other words, the caller is now buggy if it ever passes us an unaligned request that crosses cluster boundaries (the only re

[Qemu-block] [PATCH v3 3/5] qcow2: add tracepoints for qcow2_co_write_zeroes

2016-05-25 Thread Eric Blake
From: "Denis V. Lunev" This patch follows guidelines of all other tracepoints in qcow2, like ones in qcow2_co_writev. I think that they should dump values in the same quantities or be changed all together. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Kevin Wolf Message-Id: <1463476543-308

[Qemu-block] [PATCH v3 5/5] qcow2: Catch more unaligned write_zero into zero cluster

2016-05-25 Thread Eric Blake
is_zero_cluster() and is_zero_cluster_top_locked() are used only by qcow2_co_write_zeroes(). The former is too broad (we don't care if the sectors we are about to overwrite are non-zero, only that all other sectors in the cluster are zero), so it needs to be called up to twice but with smaller lim

[Qemu-block] [PATCH v3 0/5] qcow2_co_write_zeroes and related improvements

2016-05-25 Thread Eric Blake
This series improves write_zeroes for qcow2 Since the work conflicts with my proposed patches to switch write_zeroes to a byte-base interface, I figured I'd fix the bugs and get this part nailed first, then rebase my other work on top, rather than making Denis have to do the dirty work. Changes f

Re: [Qemu-block] [Qemu-devel] [PATCH v4 00/15] Dirty bitmap changes for migration/persistence work

2016-05-25 Thread Fam Zheng
On Wed, 05/25 17:45, Vladimir Sementsov-Ogievskiy wrote: > Hi! > > Are you going to update the series in the near future? Yes, probably in a couple days. Fam > > On 08.03.2016 07:44, Fam Zheng wrote: > > v4: Rebase. > > Add rev-by from John in patches 1-5, 7, 8. > > Remove BdrvDirtyB

[Qemu-block] [PULL 31/31] blockjob: Remove BlockJob.bs

2016-05-25 Thread Kevin Wolf
There is a single remaining user in qemu-img, and another one in a test case, both of which can be trivially converted to using BlockJob.blk instead. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- blockjob.c| 1 - include/block/blockjob.h | 1 - q

[Qemu-block] [PULL 30/31] commit: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the commit block job to use the job's BlockBackend for performing its I/O. job->bs isn't used by the commit code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block/commit.c | 53 +-

[Qemu-block] [PULL 27/31] backup: Pack Notifier within BackupBlockJob

2016-05-25 Thread Kevin Wolf
From: John Snow Instead of relying on peeking at bs->job, we want to explicitly get a reference to the job that was involved in this notifier callback. Pack the Notifier inside of the BackupBlockJob so we can use container_of to get a reference back to the BackupBlockJob object. This cuts out o

[Qemu-block] [PULL 26/31] backup: Don't leak BackupBlockJob in error path

2016-05-25 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/backup.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/backup.c b/block/backup.c index fec45e8..a990cf1 100644 --- a/block/backup.c +++ b/block/backup.c @@ -485,6 +485,7 @@

[Qemu-block] [PULL 21/31] block: Convert block job core to BlockBackend

2016-05-25 Thread Kevin Wolf
This adds a new BlockBackend field to the BlockJob struct, which coexists with the BlockDriverState while converting the individual jobs. When creating a block job, a new BlockBackend is created on top of the given BlockDriverState, and it is destroyed when the BlockJob ends. The reference to the

[Qemu-block] [PULL 17/31] block: Rename blk_write_zeroes()

2016-05-25 Thread Kevin Wolf
From: Eric Blake Commit 983a1600 changed the semantics of blk_write_zeroes() to be byte-based rather than sector-based, but did not change the name, which is an open invitation for other code to misuse the function. Renaming to pwrite_zeroes() makes it more in line with other byte-based interfac

[Qemu-block] [PULL 29/31] backup: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the backup block job to use the job's BlockBackend for performing its I/O. job->bs isn't used by the backup code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block/backup.c| 46 +--

[Qemu-block] [PULL 24/31] mirror: Allow target that already has a BlockBackend

2016-05-25 Thread Kevin Wolf
We had to forbid mirroring to a target BDS that already had a BB attached because the node swapping at job completion would add a second BB and we didn't support multiple BBs on a single BDS at the time. Now we do, so we can lift the restriction. As we allow additional BlockBackends for the target

[Qemu-block] [PULL 25/31] mirror: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the mirror block job to use the job's BlockBackend for performing its I/O. job->bs isn't used by the mirroring code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block/mirror.c | 70 ---

[Qemu-block] [PULL 10/31] block: Drop errp parameter from blk_new()

2016-05-25 Thread Kevin Wolf
From: Max Reitz blk_new() cannot fail so its Error ** parameter has become superfluous. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/block-backend.c | 9 ++--- blockdev.c | 6 +- include/sysemu/block-backend.h | 2 +- tests/test-throttle.c

[Qemu-block] [PULL 23/31] stream: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the streaming block job to use the job's BlockBackend for performing the COR reads. job->bs isn't used by the streaming code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- block/io.c| 9 --

[Qemu-block] [PULL 19/31] block: Cancel jobs first in bdrv_close_all()

2016-05-25 Thread Kevin Wolf
So far, bdrv_close_all() first removed all root BlockDriverStates of BlockBackends and monitor owned BDSes, and then assumed that the remaining BDSes must be related to jobs and cancelled these jobs. This order doesn't work that well any more when block jobs use BlockBackends internally because th

[Qemu-block] [PULL 22/31] block: Make blk_co_preadv/pwritev() public

2016-05-25 Thread Kevin Wolf
Also add trace points now that the function can be directly called. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block/block-backend.c | 21 ++--- include/sysemu/block-backend.h | 6 ++ trace-events

[Qemu-block] [PULL 28/31] backup: Remove bs parameter from backup_do_cow()

2016-05-25 Thread Kevin Wolf
Now that we pass the job to the function, bs is implied by that. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/backup.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/block/backup.c b/block/backup.c index a57288f..670b

[Qemu-block] [PULL 18/31] block: keep a list of block jobs

2016-05-25 Thread Kevin Wolf
From: Alberto Garcia The current way to obtain the list of existing block jobs is to iterate over all root nodes and check which ones own a job. Since we want to be able to support block jobs in other nodes as well, this patch keeps a list of jobs that is updated every time one is created or des

[Qemu-block] [PULL 15/31] dma-helpers: change interface to byte-based

2016-05-25 Thread Kevin Wolf
From: Paolo Bonzini Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- dma-helpers.c| 14 +++--- hw/block/nvme.c | 6 +++--- hw/ide/ahci.c| 6 -- hw/ide/core.c| 8 +--- hw/scsi/scsi-disk.c | 6 -- include/sysemu/dma.h | 6 +++--- t

[Qemu-block] [PULL 11/31] block: Introduce bdrv_replace_child()

2016-05-25 Thread Kevin Wolf
This adds a common function that is called when attaching a new child to a parent, removing a child from a parent and when reconfiguring the graph so that an existing child points to a different node now. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Fam Zheng --- block.c | 26

[Qemu-block] [PULL 16/31] dma-helpers: change BlockBackend to opaque value in DMAIOFunc

2016-05-25 Thread Kevin Wolf
From: Paolo Bonzini Callers of dma_blk_io have no way to pass extra data to the DMAIOFunc, because the original callback and opaque are gone by the time DMAIOFunc is called. On the other hand, the BlockBackend is usually derived from those extra data that you could pass to the DMAIOFunc (in the

[Qemu-block] [PULL 14/31] block: Propagate .drained_begin/end callbacks

2016-05-25 Thread Kevin Wolf
When draining intermediate nodes (i.e. nodes that aren't the root node for at least one of their parents; with node references, the user can always configure the graph to create this situation), we need to propagate the .drained_begin/end callbacks all the way up to the root for the drain to be eff

[Qemu-block] [PULL 12/31] block: Make bdrv_drain() use bdrv_drained_begin/end()

2016-05-25 Thread Kevin Wolf
Until now, bdrv_drained_begin() used bdrv_drain() internally to drain the queue. This is kind of backwards and caused quiescing code to be duplicated because bdrv_drained_begin() had to ensure that no new requests come in even after bdrv_drain() returns, whereas bdrv_drain() had to have them becaus

[Qemu-block] [PULL 20/31] block: Default to enabled write cache in blk_new()

2016-05-25 Thread Kevin Wolf
The existing users of the function are: 1. blk_new_open(), which already enabled the write cache 2. Some test cases that don't care about the setting 3. blockdev_init() for empty drives, where the cache mode is overridden with the value from the options when a medium is inserted Therefore, thi

[Qemu-block] [PULL 13/31] block: Fix reconfiguring graph with drained nodes

2016-05-25 Thread Kevin Wolf
When changing the BlockDriverState that a BdrvChild points to while the node is currently drained, we must call the .drained_end() parent callback. Conversely, when this means attaching a new node that is already drained, we need to call .drained_begin(). bdrv_root_attach_child() takes now an opaq

[Qemu-block] [PULL 08/31] block: Assert !bs->refcnt in bdrv_close()

2016-05-25 Thread Kevin Wolf
From: Max Reitz The only caller of bdrv_close() left is bdrv_delete(). We may as well assert that, in a way (there are some things in bdrv_close() that make more sense under that assumption, such as the call to bdrv_release_all_dirty_bitmaps() which in turn assumes that no frozen bitmaps are atta

[Qemu-block] [PULL 04/31] tests: Drop BDS from test-throttle.c

2016-05-25 Thread Kevin Wolf
From: Max Reitz Now that throttling has been moved to the BlockBackend level, we do not need to create a BDS along with the BB in the I/O throttling test. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- tests/test-throttle.c | 6 +++--- 1 file changed, 3 insert

[Qemu-block] [PULL 07/31] block: Make bdrv_open() return a BDS

2016-05-25 Thread Kevin Wolf
From: Max Reitz There are no callers to bdrv_open() or bdrv_open_inherit() left that pass a pointer to a non-NULL BDS pointer as the first argument of these functions, so we can finally drop that parameter and just make them return the new BDS. Generally, the following pattern is applied: b

[Qemu-block] [PULL 09/31] block: Drop bdrv_parent_cb_...() from bdrv_close()

2016-05-25 Thread Kevin Wolf
From: Max Reitz bdrv_close() now asserts that the BDS's refcount is 0, therefore it cannot have any parents and the bdrv_parent_cb_change_media() call is a no-op. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block.c | 2 -- 1 file changed, 2 deletions(-) di

[Qemu-block] [PULL 01/31] block: Fix bdrv_next() memory leak

2016-05-25 Thread Kevin Wolf
The bdrv_next() users all leaked the BdrvNextIterator after completing the iteration. Simply changing bdrv_next() to free the iterator before returning NULL at the end of list doesn't work because some callers exit the loop before looking at all BDSes. This patch moves the BdrvNextIterator from th

[Qemu-block] [PULL 03/31] block: Let bdrv_open_inherit() return the snapshot

2016-05-25 Thread Kevin Wolf
From: Max Reitz If bdrv_open_inherit() creates a snapshot BDS and *pbs is NULL, that snapshot BDS should be returned instead of the BDS under it. This has worked so far because (nearly) all users of BDRV_O_SNAPSHOT use blk_new_open() to create the BDS tree. bdrv_append() (which is called by bdrv

[Qemu-block] [PULL 05/31] block: Drop blk_new_with_bs()

2016-05-25 Thread Kevin Wolf
From: Max Reitz Its only caller is blk_new_open(), so we can just inline it there. The bdrv_new_root() call is dropped in the process because we can just let bdrv_open() create the BDS. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/block-backend.c | 30 +++

[Qemu-block] [PULL 00/31] Block layer patches

2016-05-25 Thread Kevin Wolf
The following changes since commit 287db79df8af8e31f18e262feb5e05103a09e4d4: Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging (2016-05-24 13:06:33 +0100) are available in the git repository at: git://repo.or.cz/qemu/kevin.git tags/for-upstream for you to

[Qemu-block] [PULL 06/31] block: Drop bdrv_new_root()

2016-05-25 Thread Kevin Wolf
From: Max Reitz It is unused now, so we may just as well drop it. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- block.c | 5 - include/block/block.h | 1 - 2 files changed, 6 deletions(-) diff --git a/block.c b/

[Qemu-block] [PULL 02/31] block: Drop useless bdrv_new() call

2016-05-25 Thread Kevin Wolf
From: Max Reitz bdrv_append_temp_snapshot() uses bdrv_new() to create an empty BDS before invoking bdrv_open() on that BDS. This is probably a relict from when it used to do some modifications on that empty BDS, but now that is unnecessary, so we can just set bs_snapshot to NULL and let bdrv_open

Re: [Qemu-block] [PATCH v2 0/7] dma-helpers, scsi-block: use SG_IO for all I/O on scsi-block

2016-05-25 Thread Kevin Wolf
Am 23.05.2016 um 14:54 hat Paolo Bonzini geschrieben: > scsi-block uses the block layer for reads and writes in order to avoid > allocating bounce buffers as big as the transferred data. We know how > to split a large transfer to multiple reads and writes, and thus we can > use scsi-disk.c's exist

Re: [Qemu-block] [PATCH v3 15/15] blockjob: Remove BlockJob.bs

2016-05-25 Thread Eric Blake
On 05/25/2016 06:29 AM, Kevin Wolf wrote: > There is a single remaining user in qemu-img, and another one in a test > case, both of which can be trivially converted to using BlockJob.blk > instead. > > Signed-off-by: Kevin Wolf > --- > blockjob.c| 1 - > include/block/blockjob.h

Re: [Qemu-block] [PATCH v3 15/15] blockjob: Remove BlockJob.bs

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > There is a single remaining user in qemu-img, and another one in a test > case, both of which can be trivially converted to using BlockJob.blk > instead. > > Signed-off-by: Kevin Wolf > --- > blockjob.c| 1 - > include/block/blockjob.h |

Re: [Qemu-block] [PATCH v3 13/15] backup: Use BlockBackend for I/O

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > This changes the backup block job to use the job's BlockBackend for > performing its I/O. job->bs isn't used by the backup code any more > afterwards. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake > --- > block/backup.c| 46

Re: [Qemu-block] [PATCH 09/13] qed: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 16:28 hat Eric Blake geschrieben: > On 05/25/2016 08:07 AM, Kevin Wolf wrote: > > Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > >> Another step on our continuing quest to switch to byte-based > >> interfaces. > >> > >> Kill an abuse of the comma operator while at it (fortuna

Re: [Qemu-block] [PATCH v3 14/15] commit: Use BlockBackend for I/O

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > This changes the commit block job to use the job's BlockBackend for > performing its I/O. job->bs isn't used by the commit code any more > afterwards. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake > --- > block/commit.c | 53 +++

Re: [Qemu-block] [PATCH v3 09/15] mirror: Use BlockBackend for I/O

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > This changes the mirror block job to use the job's BlockBackend for > performing its I/O. job->bs isn't used by the mirroring code any more > afterwards. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake > --- > block/mirror.c | 70 > +

Re: [Qemu-block] [PATCH v3 07/15] stream: Use BlockBackend for I/O

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > This changes the streaming block job to use the job's BlockBackend for > performing the COR reads. job->bs isn't used by the streaming code any > more afterwards. > > Signed-off-by: Kevin Wolf > Reviewed-by: Eric Blake > Reviewed-by: Alberto Garcia > ---

Re: [Qemu-block] [PATCH v3 06/15] block: Make blk_co_preadv/pwritev() public

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > Also add trace points now that the function can be directly called. > > Signed-off-by: Kevin Wolf > --- > block/block-backend.c | 21 ++--- > include/sysemu/block-backend.h | 6 ++ > trace-events | 4 >

Re: [Qemu-block] [PATCH v3 05/15] block: Convert block job core to BlockBackend

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > This adds a new BlockBackend field to the BlockJob struct, which > coexists with the BlockDriverState while converting the individual jobs. > > When creating a block job, a new BlockBackend is created on top of the > given BlockDriverState, and it is destro

Re: [Qemu-block] [PATCH 12/13] vmdk: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Eric Blake
On 05/25/2016 08:23 AM, Kevin Wolf wrote: > Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: >> Another step on our continuing quest to switch to byte-based >> interfaces. >> >> Signed-off-by: Eric Blake >> --- >> block/vmdk.c | 13 ++--- >> 1 file changed, 6 insertions(+), 7 deletions(

Re: [Qemu-block] [PATCH v3 01/15] block: Rename blk_write_zeroes()

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > From: Eric Blake > > Commit 983a1600 changed the semantics of blk_write_zeroes() to > be byte-based rather than sector-based, but did not change the > name, which is an open invitation for other code to misuse the > function. Renaming to pwrite_zeroes() m

Re: [Qemu-block] [PATCH v4 00/15] Dirty bitmap changes for migration/persistence work

2016-05-25 Thread Vladimir Sementsov-Ogievskiy
Hi! Are you going to update the series in the near future? On 08.03.2016 07:44, Fam Zheng wrote: v4: Rebase. Add rev-by from John in patches 1-5, 7, 8. Remove BdrvDirtyBitmap typedef from dirty-bitmap.h in patch 4. [Max] Add assertion on bm->meta in patch 9. [John] Two major fea

Re: [Qemu-block] [PATCH v3 03/15] block: Cancel jobs first in bdrv_close_all()

2016-05-25 Thread Max Reitz
On 25.05.2016 14:29, Kevin Wolf wrote: > So far, bdrv_close_all() first removed all root BlockDriverStates of > BlockBackends and monitor owned BDSes, and then assumed that the > remaining BDSes must be related to jobs and cancelled these jobs. > > This order doesn't work that well any more when b

Re: [Qemu-block] [PATCH 13/13] block: Kill bdrv_co_write_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Now that all drivers have been converted to a byte interface, > we no longer need a sector interface. > > Signed-off-by: Eric Blake Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH 12/13] vmdk: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > Signed-off-by: Eric Blake > --- > block/vmdk.c | 13 ++--- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/block/vmdk.c b/block/vmdk.c >

Re: [Qemu-block] [PATCH 09/13] qed: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Eric Blake
On 05/25/2016 08:07 AM, Kevin Wolf wrote: > Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: >> Another step on our continuing quest to switch to byte-based >> interfaces. >> >> Kill an abuse of the comma operator while at it (fortunately, >> the semantics were still right). >> >> Signed-off-by:

Re: [Qemu-block] [PATCH v5 27/27] qemu-iotests: Add test case 153 for image locking

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/153 | 197 + > tests/qemu-iotests/153.out | 426 > + > tests/qemu-iotests/group | 1 + > 3 files changed, 624 insertions(+) > creat

Re: [Qemu-block] [PATCH 11/13] raw_bsd: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > Signed-off-by: Eric Blake Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH 10/13] raw-posix: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > Signed-off-by: Eric Blake > --- > block/raw-posix.c | 37 +++-- > trace-events | 2 +- > 2 files changed, 16 insertions(+), 23

Re: [Qemu-block] [PATCH 09/13] qed: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > Kill an abuse of the comma operator while at it (fortunately, > the semantics were still right). > > Signed-off-by: Eric Blake > --- > block/qed.c | 25 +++

Re: [Qemu-block] [PATCH v3 06/15] block: Make blk_co_preadv/pwritev() public

2016-05-25 Thread Eric Blake
On 05/25/2016 06:29 AM, Kevin Wolf wrote: > Also add trace points now that the function can be directly called. > > Signed-off-by: Kevin Wolf > --- > block/block-backend.c | 21 ++--- > include/sysemu/block-backend.h | 6 ++ > trace-events | 4 +++

Re: [Qemu-block] [PATCH v5 26/27] block: Turn on image locking by default

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > Now that test cases are covered, we can turn it on. > > Signed-off-by: Fam Zheng > --- > blockdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH 08/13] gluster: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > Signed-off-by: Eric Blake > --- > block/gluster.c | 15 +++ > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/block/gluster.c b/block/

Re: [Qemu-block] [PATCH v5 25/27] tests: Use null-co:// instead of /dev/null

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > With image locking, opening /dev/null can fail when multiple tests run > in parallel (make -j2, for example). Use null-co:// as the null protocol > doesn't do image locking. > > While it's arguable we could special-case /dev/null, /dev/zero, > /dev/urandom e

Re: [Qemu-block] [PATCH 07/13] blkreplay: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > Signed-off-by: Eric Blake Reviewed-by: Kevin Wolf

Re: [Qemu-block] [PATCH 06/13] qcow2: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > There are still opportunities to optimize the qcow2 handling > of zero clusters. For example, if the backing file only has > non-zero data in the portion about to be

Re: [Qemu-block] [PATCH v5 24/27] iotests: Disable image locking in 085

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > The cases is about live snapshot features. Disable image locking because > otherwise a few tests are going to fail because we reuse the same images > at blockdev-add. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/085 | 3 ++- > 1 file changed, 2

Re: [Qemu-block] [PATCH 04/13] block: Switch bdrv_write_zeroes() to byte interface

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Rename to bdrv_pwrite_zeroes() to let the compiler ensure we > cater to the updated semantics. Do the same for > bdrv_aio_write_zeroes() and bdrv_co_write_zeroes(). For now, > we still require sector alignment in the callers, via assertions. >

Re: [Qemu-block] [PATCH v5 23/27] iotests: 087: Disable image lock in cases where file is shared

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > Otherwise the error handling we are expceting will be masked by the *expecting > preceding image locking check, and is going to be indistinguishable > because the error messages are all the same. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/08

Re: [Qemu-block] [PATCH v3 06/15] block: Make blk_co_preadv/pwritev() public

2016-05-25 Thread Alberto Garcia
On Wed 25 May 2016 02:29:14 PM CEST, Kevin Wolf wrote: > Also add trace points now that the function can be directly called. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH v5 23/27] iotests: 087: Disable image lock in cases where file is shared

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > Otherwise the error handling we are expceting will be masked by the *expecting > preceding image locking check, and is going to be indistinguishable > because the error messages are all the same. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/08

Re: [Qemu-block] [PATCH v5 20/27] qemu-iotests: 046: Move version detection out from verify_io

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > So the image lock won't complain. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/046 | 22 -- > 1 file changed, 12 insertions(+), 10 deletions(-) > > diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046 > index e528b67

Re: [Qemu-block] [PATCH v5 19/27] qemu-iotests: 140: Disable image lock for qemu-io access

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > The VM is still on, the image locking check would complain. No, it wouldn't. We are opening an NBD URL that is provided by the VM. Even if it would, we are only reading data, so an -r would probably be better than an -L. Max > > Signed-off-by: Fam Zheng

Re: [Qemu-block] [PATCH 05/13] iscsi: Convert to bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Another step on our continuing quest to switch to byte-based > interfaces. > > As this is the first byte-based iscsi interface, convert > is_request_lun_aligned() into two versions, one for sectors > and one for bytes. > > Signed-off-by: Eric B

Re: [Qemu-block] [PATCH v5 22/27] qemu-iotests: 030: Disable image lock when checking test image

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > The VM is running, qemu-io would fail the lock acquisition. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/030 | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Max Reitz signature.asc Description: OpenPGP digital signature

Re: [Qemu-block] [PATCH v5 21/27] qemu-iotests: Wait for QEMU processes before checking image in 091

2016-05-25 Thread Max Reitz
On 17.05.2016 09:35, Fam Zheng wrote: > We should wait for the QEMU process to terminate and close the image > before we check the data. > > Signed-off-by: Fam Zheng > --- > tests/qemu-iotests/091 | 3 +++ > tests/qemu-iotests/091.out | 1 + > 2 files changed, 4 insertions(+) Reviewed-by: M

Re: [Qemu-block] [PATCH 03/13] block: Add .bdrv_co_pwrite_zeroes()

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 00:25 hat Eric Blake geschrieben: > Update bdrv_co_do_write_zeroes() to be byte-based, and select > between the new byte-based bdrv_co_pwrite_zeroes() or the old > bdrv_co_write_zeroes(). The next patches will convert drivers, > then remove the old interface. > > Signed-off-by: E

[Qemu-block] [PATCH v3 13/15] backup: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the backup block job to use the job's BlockBackend for performing its I/O. job->bs isn't used by the backup code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/backup.c| 46 +- block/io.c

[Qemu-block] [PATCH v3 12/15] backup: Remove bs parameter from backup_do_cow()

2016-05-25 Thread Kevin Wolf
Now that we pass the job to the function, bs is implied by that. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/backup.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/block/backup.c b/block/backup.c index a57288f..670b

[Qemu-block] [PATCH v3 14/15] commit: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the commit block job to use the job's BlockBackend for performing its I/O. job->bs isn't used by the commit code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/commit.c | 53 + 1 file changed, 33

Re: [Qemu-block] [Qemu-devel] [PATCH v2] nbd: Don't trim unrequested bytes

2016-05-25 Thread Kevin Wolf
Am 25.05.2016 um 13:25 hat Eric Blake geschrieben: > On 05/25/2016 04:59 AM, Eric Blake wrote: > > +/* Ignore unaligned head or tail, until block layer adds byte > > + * interface */ > > +if (request.len >= BDRV_SECTOR_SIZE) { > > +request.len -= (request.from +

[Qemu-block] [PATCH v3 08/15] mirror: Allow target that already has a BlockBackend

2016-05-25 Thread Kevin Wolf
We had to forbid mirroring to a target BDS that already had a BB attached because the node swapping at job completion would add a second BB and we didn't support multiple BBs on a single BDS at the time. Now we do, so we can lift the restriction. As we allow additional BlockBackends for the target

[Qemu-block] [PATCH v3 15/15] blockjob: Remove BlockJob.bs

2016-05-25 Thread Kevin Wolf
There is a single remaining user in qemu-img, and another one in a test case, both of which can be trivially converted to using BlockJob.blk instead. Signed-off-by: Kevin Wolf --- blockjob.c| 1 - include/block/blockjob.h | 1 - qemu-img.c| 2 +- tests/test-block

[Qemu-block] [PATCH v3 10/15] backup: Don't leak BackupBlockJob in error path

2016-05-25 Thread Kevin Wolf
Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/backup.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/backup.c b/block/backup.c index fec45e8..a990cf1 100644 --- a/block/backup.c +++ b/block/backup.c @@ -485,6 +485,7 @@

[Qemu-block] [PATCH v3 11/15] backup: Pack Notifier within BackupBlockJob

2016-05-25 Thread Kevin Wolf
From: John Snow Instead of relying on peeking at bs->job, we want to explicitly get a reference to the job that was involved in this notifier callback. Pack the Notifier inside of the BackupBlockJob so we can use container_of to get a reference back to the BackupBlockJob object. This cuts out o

[Qemu-block] [PATCH v3 09/15] mirror: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the mirror block job to use the job's BlockBackend for performing its I/O. job->bs isn't used by the mirroring code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/mirror.c | 70 -- blockdev.c

[Qemu-block] [PATCH v3 07/15] stream: Use BlockBackend for I/O

2016-05-25 Thread Kevin Wolf
This changes the streaming block job to use the job's BlockBackend for performing the COR reads. job->bs isn't used by the streaming code any more afterwards. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block/io.c| 9 - block/stream.c

[Qemu-block] [PATCH v3 00/15] block jobs: Convert I/O to BlockBackend

2016-05-25 Thread Kevin Wolf
This series changes the block jobs so that they have a separate BlockBackend for every node on which they perform I/O. This doesn't only get us closer to the goal of only doing I/O through blk_*() from external sources (and block jobs are considered external), but can also later be used to use Bloc

[Qemu-block] [PATCH v3 03/15] block: Cancel jobs first in bdrv_close_all()

2016-05-25 Thread Kevin Wolf
So far, bdrv_close_all() first removed all root BlockDriverStates of BlockBackends and monitor owned BDSes, and then assumed that the remaining BDSes must be related to jobs and cancelled these jobs. This order doesn't work that well any more when block jobs use BlockBackends internally because th

[Qemu-block] [PATCH v3 06/15] block: Make blk_co_preadv/pwritev() public

2016-05-25 Thread Kevin Wolf
Also add trace points now that the function can be directly called. Signed-off-by: Kevin Wolf --- block/block-backend.c | 21 ++--- include/sysemu/block-backend.h | 6 ++ trace-events | 4 3 files changed, 24 insertions(+), 7 deletions(-) di

[Qemu-block] [PATCH v3 01/15] block: Rename blk_write_zeroes()

2016-05-25 Thread Kevin Wolf
From: Eric Blake Commit 983a1600 changed the semantics of blk_write_zeroes() to be byte-based rather than sector-based, but did not change the name, which is an open invitation for other code to misuse the function. Renaming to pwrite_zeroes() makes it more in line with other byte-based interfac

[Qemu-block] [PATCH v3 04/15] block: Default to enabled write cache in blk_new()

2016-05-25 Thread Kevin Wolf
The existing users of the function are: 1. blk_new_open(), which already enabled the write cache 2. Some test cases that don't care about the setting 3. blockdev_init() for empty drives, where the cache mode is overridden with the value from the options when a medium is inserted Therefore, thi

[Qemu-block] [PATCH v3 05/15] block: Convert block job core to BlockBackend

2016-05-25 Thread Kevin Wolf
This adds a new BlockBackend field to the BlockJob struct, which coexists with the BlockDriverState while converting the individual jobs. When creating a block job, a new BlockBackend is created on top of the given BlockDriverState, and it is destroyed when the BlockJob ends. The reference to the

[Qemu-block] [PATCH v3 02/15] block: keep a list of block jobs

2016-05-25 Thread Kevin Wolf
From: Alberto Garcia The current way to obtain the list of existing block jobs is to iterate over all root nodes and check which ones own a job. Since we want to be able to support block jobs in other nodes as well, this patch keeps a list of jobs that is updated every time one is created or des

Re: [Qemu-block] [PATCH v2 14/14] blockjob: Remove BlockJob.bs

2016-05-25 Thread Alberto Garcia
On Tue 24 May 2016 03:47:34 PM CEST, Kevin Wolf wrote: > There is a single remaining user in qemu-img, which can be trivially > converted to using BlockJob.blk instead. > > Signed-off-by: Kevin Wolf > Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH v2 11/14] backup: Remove bs parameter from backup_do_cow()

2016-05-25 Thread Alberto Garcia
On Tue 24 May 2016 03:47:31 PM CEST, Kevin Wolf wrote: > Now that we pass the job to the function, bs is implied by that. > > Signed-off-by: Kevin Wolf > Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia Berto

Re: [Qemu-block] [PATCH v2 06/14] stream: Use BlockBackend for I/O

2016-05-25 Thread Alberto Garcia
On Tue 24 May 2016 03:47:26 PM CEST, Kevin Wolf wrote: > This changes the streaming block job to use the job's BlockBackend for > performing the COR reads. job->bs isn't used by the streaming code any > more afterwards. > > Signed-off-by: Kevin Wolf Reviewed-by: Alberto Garcia Berto

  1   2   >