Re: [Qemu-devel] [PATCH v2 1/2] virtio: introduce little edian functions for virtio_cread/write# family

2016-11-26 Thread Michael S. Tsirkin
On Tue, Nov 22, 2016 at 04:10:22PM +0800, Gonglei wrote: > Virtio modern devices are always little edian, let's introduce > the LE functions for read/write configuration space for > virtio modern devices, which avoid complaint by Sparse when > we use the virtio_creaed/virtio_cwrite in VIRTIO_1 devi

Re: [Qemu-devel] [PATCH v2 2/2] crypto: add virtio-crypto driver

2016-11-26 Thread Michael S. Tsirkin
On Tue, Nov 22, 2016 at 04:10:23PM +0800, Gonglei wrote: > This patch introduces virtio-crypto driver for Linux Kernel. > > The virtio crypto device is a virtual cryptography device > as well as a kind of virtual hardware accelerator for > virtual machines. The encryption anddecryption requests >

Re: [Qemu-devel] [PATCH v2 03/24] block: Add BDS.backing_overridden

2016-11-26 Thread Max Reitz
On 27.11.2016 02:56, Max Reitz wrote: > If the backing file is overridden, this most probably does change the > guest-visible data of a BDS. Therefore, we will need to consider this in > bdrv_refresh_filename(). > > Adding a new field to the BDS is not nice, but it is very simple and > exactly kee

[Qemu-devel] [PATCH v2 23/24] block/curl: Implement bdrv_refresh_filename()

2016-11-26 Thread Max Reitz
Signed-off-by: Max Reitz --- block/curl.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/block/curl.c b/block/curl.c index 0777d5b..4725caf 100644 --- a/block/curl.c +++ b/block/curl.c @@ -872,6 +872,20 @@ static int64_t curl_getlength(BlockDriverState *bs) return s-

[Qemu-devel] [PATCH v2 24/24] block/null: Generate filename even with latency-ns

2016-11-26 Thread Max Reitz
While we cannot represent the latency-ns option in a filename, it is not a significant option so not being able to should not stop us from generating a filename nonetheless. Signed-off-by: Max Reitz --- block/null.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/null

[Qemu-devel] [PATCH v2 21/24] block: Purify .bdrv_refresh_filename()

2016-11-26 Thread Max Reitz
Currently, BlockDriver.bdrv_refresh_filename() is supposed to both refresh the filename (BDS.exact_filename) and set BDS.full_open_options. Now that we have generic code in the central bdrv_refresh_filename() for creating BDS.full_open_options, we can drop the latter part from all BlockDriver.bdrv_

[Qemu-devel] [PATCH v2 22/24] block: Do not copy exact_filename from format file

2016-11-26 Thread Max Reitz
If the a format BDS's file BDS is in turn a format BDS, we cannot simply use the same filename, because when opening a BDS tree based on a filename alone, qemu will create only one format node on top of one protocol node (disregarding a potential backing file). Signed-off-by: Max Reitz --- block

[Qemu-devel] [PATCH v2 19/24] block: Add BlockDriver.bdrv_gather_child_options

2016-11-26 Thread Max Reitz
Some follow-up patches will rework the way bs->full_open_options is refreshed in bdrv_refresh_filename(). The new implementation will remove the need for the block drivers' bdrv_refresh_filename() implementations to set bs->full_open_options; instead, it will be generic and use static information f

[Qemu-devel] [PATCH v2 16/24] block: Add 'base-directory' BDS option

2016-11-26 Thread Max Reitz
Using this option, one can directly override what bdrv_dirname() will return. This is useful if one uses e.g. qcow2 on top of quorum (with only protocol BDSs under the quorum BDS) and wants to be able to use relative backing filenames. Signed-off-by: Max Reitz --- block.c | 14

[Qemu-devel] [PATCH v2 20/24] block: Generically refresh runtime options

2016-11-26 Thread Max Reitz
Instead of having every block driver which implements bdrv_refresh_filename() copy all of the significant runtime options over to bs->full_open_options, implement this process generically in bdrv_refresh_filename(). This patch only adds this new generic implementation, it does not remove the old f

[Qemu-devel] [PATCH v2 14/24] block/nfs: Implement bdrv_dirname()

2016-11-26 Thread Max Reitz
While the basic idea is obvious and could be handled by the default bdrv_dirname() implementation, we cannot generate a directory name if the gid or uid are set, so we have to explicitly return NULL in those cases. Signed-off-by: Max Reitz --- block/nfs.c | 14 ++ 1 file changed, 14

[Qemu-devel] [PATCH v2 13/24] block/nbd: Implement bdrv_dirname()

2016-11-26 Thread Max Reitz
The idea behind this implementation is that the export name might be interpreted as a path (which is the only apparent interpretation of relative filenames for NBD paths). The default implementation of bdrv_dirname() would handle that just fine for nbd+tcp, but not for nbd+unix, because in that ca

[Qemu-devel] [PATCH v2 17/24] iotests: Add quorum case to test 110

2016-11-26 Thread Max Reitz
Test 110 tests relative backing filenames for complex BDS trees. Add quorum as an example that can never work automatically (without special-casing if all child nodes have the same base directory), and an example on how to make it work manually (using the base-directory option). Signed-off-by: Max

[Qemu-devel] [PATCH v2 12/24] quorum: Make bdrv_dirname() return NULL

2016-11-26 Thread Max Reitz
While the common implementation for bdrv_dirname() should return NULL for quorum BDSs already (because they do not have a file node and their exact_filename field should be empty), there is no reason not to make that explicit. Signed-off-by: Max Reitz --- block/quorum.c | 11 +++ 1 file

[Qemu-devel] [PATCH v2 08/24] block: Add bdrv_make_absolute_filename()

2016-11-26 Thread Max Reitz
This is a general function for making a filename that is relative to a certain BDS absolute. It calls bdrv_get_full_backing_filename_from_filename() for now, but that will be changed in a follow-up patch. Signed-off-by: Max Reitz --- block.c | 15 +++ 1 file changed, 11 insertions(+

[Qemu-devel] [PATCH v2 11/24] blkverify: Make bdrv_dirname() return NULL

2016-11-26 Thread Max Reitz
blkverify's BDSs have a file BDS, but we do not want this to be preferred over the raw node. There is no way to decide between the two (and not really a reason to, either), so just return NULL in blkverify's implementation of bdrv_dirname(). Signed-off-by: Max Reitz --- block/blkverify.c | 10 ++

[Qemu-devel] [PATCH v2 10/24] block: Add bdrv_dirname()

2016-11-26 Thread Max Reitz
This function may be implemented by block drivers to derive a directory name from a BDS. Concatenating this g_free()-able string with a relative filename must result in a valid (not necessarily existing) filename, so this is a function that should generally be not implemented by format drivers, bec

[Qemu-devel] [PATCH v2 18/24] block: Add sgfnt_runtime_opts to BlockDriver

2016-11-26 Thread Max Reitz
This new field can be set by block drivers to list the runtime options they accept that may influence the contents of the respective BDS. As of a follow-up patch, this list will be used by the common bdrv_refresh_filename() implementation to decide which options to put into BDS.full_open_options (a

[Qemu-devel] [PATCH v2 07/24] block: bdrv_get_full_backing_filename's ret. val.

2016-11-26 Thread Max Reitz
Make bdrv_get_full_backing_filename() return an allocated string instead of placing the result in a caller-provided buffer. Signed-off-by: Max Reitz --- block.c | 26 +- block/qapi.c | 12 ++-- include/block/block.h | 3 +-- 3 files changed

[Qemu-devel] [PATCH v2 04/24] block: Respect backing bs in bdrv_refresh_filename

2016-11-26 Thread Max Reitz
Basically, bdrv_refresh_filename() should respect all children of a BlockDriverState. However, generally those children are driver-specific, so this function cannot handle the general case. On the other hand, there are only few drivers which use other children than @file and @backing (that being vm

[Qemu-devel] [PATCH v2 15/24] block: Use bdrv_dirname() for relative filenames

2016-11-26 Thread Max Reitz
bdrv_get_full_backing_filename_from_filename() breaks down when it comes to JSON filenames. Using bdrv_dirname() as the basis is better because since we have BDS, we can descend through the BDS tree to the protocol layer, which gives us a greater probability of finding a non-JSON name; also, bdrv_d

[Qemu-devel] [PATCH v2 09/24] block: Fix bdrv_find_backing_image()

2016-11-26 Thread Max Reitz
bdrv_find_backing_image() should use bdrv_get_full_backing_filename() or bdrv_make_absolute_filename() instead of trying to do what those functions do by itself. path_combine_deprecated() can now be dropped, so let's do that. Signed-off-by: Max Reitz --- block.c | 28 +--

[Qemu-devel] [PATCH v2 02/24] block: Use children list in bdrv_refresh_filename

2016-11-26 Thread Max Reitz
bdrv_refresh_filename() should invoke itself recursively on all children, not just on file. With that change, we can remove the manual invocations in blkverify and quorum. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia --- block.c | 9 + block/b

[Qemu-devel] [PATCH v2 03/24] block: Add BDS.backing_overridden

2016-11-26 Thread Max Reitz
If the backing file is overridden, this most probably does change the guest-visible data of a BDS. Therefore, we will need to consider this in bdrv_refresh_filename(). Adding a new field to the BDS is not nice, but it is very simple and exactly keeps track of whether the backing file has been over

[Qemu-devel] [PATCH v2 01/24] block/mirror: Small absolute-paths simplification

2016-11-26 Thread Max Reitz
When invoking drive-mirror in absolute-paths mode, the target's backing BDS is assigned to it in mirror_complete(). The current logic only does so if the target does not have that backing BDS already; but it actually cannot have a backing BDS at all (the BDS is opened with O_NO_BACKING in qmp_drive

[Qemu-devel] [PATCH v2 06/24] block: bdrv_get_full_backing_filename_from_...'s ret. val.

2016-11-26 Thread Max Reitz
Make bdrv_get_full_backing_filename_from_filename() return an allocated string instead of placing the result in a caller-provided buffer. Signed-off-by: Max Reitz --- block.c | 32 +++- block/vmdk.c | 8 +++- include/block/block.h | 7 +++-

[Qemu-devel] [PATCH v2 05/24] block: Make path_combine() return the path

2016-11-26 Thread Max Reitz
Besides being safe for arbitrary path lengths, after some follow-up patches all callers will want a freshly allocated buffer anyway. In the meantime, path_combine_deprecated() is added which has the same interface as path_combine() had before this patch. All callers to that function will be conver

[Qemu-devel] [PATCH v2 00/24] block: Fix some filename generation issues

2016-11-26 Thread Max Reitz
Finally, a year after I (allegedly) started working on this, here is v2! Rejoice! There are some issues regarding filename generation right now: - You always get a JSON filename if you set even a single qcow2-specific runtime options (as long as it does not have a dot in it, which is a bug,

[Qemu-devel] [PATCH for-2.9] block/curl: Prefer URL in options over filename

2016-11-26 Thread Max Reitz
Currently, the curl block driver will replace any URL specified through the options QDict by a filename, if one has been given. However, the options QDict should generally take precedence, which is implemented by this patch. Signed-off-by: Max Reitz --- Not really critical, so getting this into 2

Re: [Qemu-devel] [Qemu-stable] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba

2016-11-26 Thread Fam Zheng
On Sat, 11/26 06:46, QingFeng Hao wrote: > The problem was triggered by qemu-iotests case 055. It failed when it > was comparing the compressed vmdk image with original test.img. > > The cause is that buf_len in vmdk_write_extent wasn't converted to > little-endian before it was stored to disk. Bu

Re: [Qemu-devel] [PATCH v2 0/2] virtio-crypto: add Linux driver

2016-11-26 Thread Gonglei (Arei)
Hi, > -Original Message- > From: Gonglei (Arei) > Sent: Tuesday, November 22, 2016 4:10 PM > To: linux-ker...@vger.kernel.org; qemu-devel@nongnu.org; > virtio-...@lists.oasis-open.org; virtualizat...@lists.linux-foundation.org; > linux-cry...@vger.kernel.org > Subject: [PATCH v2 0/2] virti