[Qemu-block] [PATCH v5 4/6] block: qobject_is_equal() in bdrv_reopen_prepare()

2017-09-16 Thread Max Reitz
Currently, bdrv_reopen_prepare() assumes that all BDS options are strings. However, this is not the case if the BDS has been created through the json: pseudo-protocol or blockdev-add. Note that the user-invokable reopen command is an HMP command, so you can only specify strings there. Therefore, s

[Qemu-block] [PATCH v5 6/6] tests: Add check-qobject for equality tests

2017-09-16 Thread Max Reitz
Add a new test file (check-qobject.c) for unit tests that concern QObjects as a whole. Its only purpose for now is to test the qobject_is_equal() function. Signed-off-by: Max Reitz --- tests/Makefile.include | 4 +- tests/check-qobject.c | 315

[Qemu-block] [PATCH v5 3/6] qapi: Add qobject_is_equal()

2017-09-16 Thread Max Reitz
This generic function (along with its implementations for different types) determines whether two QObjects are equal. Signed-off-by: Max Reitz --- include/qapi/qmp/qbool.h | 1 + include/qapi/qmp/qdict.h | 1 + include/qapi/qmp/qlist.h | 1 + include/qapi/qmp/qnull.h | 2 ++ include/

[Qemu-block] [PATCH v5 5/6] iotests: Add test for non-string option reopening

2017-09-16 Thread Max Reitz
Reviewed-by: Kevin Wolf Signed-off-by: Max Reitz --- tests/qemu-iotests/133 | 9 + tests/qemu-iotests/133.out | 5 + 2 files changed, 14 insertions(+) diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133 index 9d35a6a1ca..af6b3e1dd4 100755 --- a/tests/qemu-iotests/133 ++

[Qemu-block] [PATCH v5 2/6] qapi/qlist: Add qlist_append_null() macro

2017-09-16 Thread Max Reitz
Signed-off-by: Max Reitz --- include/qapi/qmp/qlist.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h index c4b5fdad9b..59d209bbae 100644 --- a/include/qapi/qmp/qlist.h +++ b/include/qapi/qmp/qlist.h @@ -15,6 +15,7 @@ #include "qapi/qm

[Qemu-block] [PATCH v5 1/6] qapi/qnull: Add own header

2017-09-16 Thread Max Reitz
Signed-off-by: Max Reitz --- include/qapi/qmp/qdict.h| 1 + include/qapi/qmp/qnull.h| 30 ++ include/qapi/qmp/qobject.h | 12 include/qapi/qmp/types.h| 1 + qapi/qapi-clone-visitor.c | 1 + qapi/string-input-visitor.c | 1 + qobject/qnul

[Qemu-block] [PATCH v5 0/6] block: Don't compare strings in bdrv_reopen_prepare()

2017-09-16 Thread Max Reitz
bdrv_reopen_prepare() assumes that all BDS options are strings, which is not necessarily correct. This series introduces a new qobject_is_equal() function which can be used to test whether any options have changed, independently of their type. v5: - Patch 1: Changes due to rebase - Patch 2: Added

Re: [Qemu-block] [PATCH v3 7/7] block: support passthrough of BDRV_REQ_FUA in crypto driver

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > The BDRV_REQ_FUA flag can trivially be allowed in the crypt driver > as a passthrough to the underlying block driver. > > Signed-off-by: Daniel P. Berrange > --- > block/crypto.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) Revi

Re: [Qemu-block] [PATCH v3 6/7] block: convert qcrypto_block_encrypt|decrypt to take bytes offset

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > Instead of sector offset, take the bytes offset when encrypting > or decrypting data. > > Signed-off-by: Daniel P. Berrange > --- > block/crypto.c | 12 > block/qcow.c | 7 +-- > block/qcow2-cluster.c | 8 +++-

Re: [Qemu-block] [PATCH v3 5/7] block: convert crypto driver to bdrv_co_preadv|pwritev

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > Make the crypto driver implement the bdrv_co_preadv|pwritev > callbacks, and also use bdrv_co_preadv|pwritev for I/O > with the protocol driver beneath. > > Signed-off-by: Daniel P. Berrange > --- > block/crypto.c | 104 >

Re: [Qemu-block] [PATCH v3 3/7] block: fix data type casting for crypto payload offset

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > The crypto APIs report the offset of the data payload as an uint64_t > type, but the block driver is casting to size_t or ssize_t which will > potentially truncate. > > Most of the block APIs use int64_t for offsets meanwhile, so even if > using uin

Re: [Qemu-block] [PATCH v3 2/7] crypto: expose encryption sector size in APIs

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > While current encryption schemes all have a fixed sector size of > 512 bytes, this is not guaranteed to be the case in future. Expose > the sector size in the APIs so the block layer can remove assumptions > about fixed 512 byte sectors. > > Signed-

Re: [Qemu-block] [PATCH v3 1/7] block: use 1 MB bounce buffers for crypto instead of 16KB

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > Using 16KB bounce buffers creates a significant performance > penalty for I/O to encrypted volumes on storage which high > I/O latency (rotating rust & network drives), because it > triggers lots of fairly small I/O operations. > > On tests with rot

Re: [Qemu-block] [PATCH v3 4/7] block: don't use constant 512 as sector size in crypto driver

2017-09-16 Thread Max Reitz
On 2017-09-12 13:28, Daniel P. Berrange wrote: > Use the qcrypto_block_get_sector_size() value in the block > crypto driver instead of hardcoding 512 as the sector size. > > Signed-off-by: Daniel P. Berrange > --- > block/crypto.c | 34 ++ > 1 file changed, 18 ins

Re: [Qemu-block] [PATCH v7 1/4] qemu-img: add --shrink flag for resize

2017-09-16 Thread Max Reitz
On 2017-08-17 11:15, Pavel Butsykin wrote: > The flag is additional precaution against data loss. Perhaps in the future the > operation shrink without this flag will be blocked for all formats, but for > now > we need to maintain compatibility with raw. > > Signed-off-by: Pavel Butsykin > Review

Re: [Qemu-block] [PATCH v7 3/4] qcow2: add shrink image support

2017-09-16 Thread Max Reitz
On 2017-08-17 11:15, Pavel Butsykin wrote: > This patch add shrinking of the image file for qcow2. As a result, this allows > us to reduce the virtual image size and free up space on the disk without > copying the image. Image can be fragmented and shrink is done by punching > holes > in the image

Re: [Qemu-block] [PATCH v7 2/4] qcow2: add qcow2_cache_discard

2017-09-16 Thread Max Reitz
On 2017-08-17 11:15, Pavel Butsykin wrote: > Whenever l2/refcount table clusters are discarded from the file we can > automatically drop unnecessary content of the cache tables. This reduces > the chance of eviction useful cache data and eliminates inconsistent data > in the cache with the data in

Re: [Qemu-block] [Qemu-devel] [PATCH v7 0/4] Add shrink image for qcow2

2017-09-16 Thread Max Reitz
On 2017-08-22 01:31, John Snow wrote: > > > On 08/17/2017 05:15 AM, Pavel Butsykin wrote: >> This patch add shrinking of the image file for qcow2. As a result, this >> allows >> us to reduce the virtual image size and free up space on the disk without >> copying the image. Image can be fragmente

Re: [Qemu-block] [PATCH 00/18] block/mirror: Add active-sync mirroring

2017-09-16 Thread Max Reitz
On 2017-09-14 17:42, Stefan Hajnoczi wrote: > On Wed, Sep 13, 2017 at 08:18:52PM +0200, Max Reitz wrote: >> There may be a couple of things to do on top of this series: >> - Allow switching between active and passive mode at runtime: This >> should not be too difficult to implement, the main ques

Re: [Qemu-block] [PATCH 15/18] block/mirror: Add active mirroring

2017-09-16 Thread Max Reitz
On 2017-09-14 17:57, Stefan Hajnoczi wrote: > On Wed, Sep 13, 2017 at 08:19:07PM +0200, Max Reitz wrote: >> This patch implements active synchronous mirroring. In active mode, the >> passive mechanism will still be in place and is used to copy all >> initially dirty clusters off the source disk; b