Re: [Qemu-devel] [PATCH v5] snapshot: use local variable to bdrv_pwrite_sync L1 table

2014-10-22 Thread Max Reitz
On 2014-10-22 at 14:39, Zhang Haoyu wrote: Use local variable to bdrv_pwrite_sync L1 table, needless to make conversion of cached L1 table between big-endian and host style. Signed-off-by: Zhang Haoyu Reviewed-by: Max Reitz --- v4 -> v5: - delete superfluous check of "l1_size2 != 0&q

Re: [Qemu-devel] [PATCH v2 3/3] iotests: Add test for map commands

2014-10-22 Thread Max Reitz
On 2014-10-22 at 15:51, Kevin Wolf wrote: Am 22.10.2014 um 15:24 hat Max Reitz geschrieben: Add a test for qemu-img map and qemu-io -c map on truncated files. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf But how about adding a case for patch 2, too? Or is that one mostly theoretical

Re: [Qemu-devel] [PATCH v2 3/3] iotests: Add test for map commands

2014-10-22 Thread Max Reitz
On 2014-10-22 at 15:54, Max Reitz wrote: On 2014-10-22 at 15:51, Kevin Wolf wrote: Am 22.10.2014 um 15:24 hat Max Reitz geschrieben: Add a test for qemu-img map and qemu-io -c map on truncated files. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf But how about adding a case for patch 2

Re: [Qemu-devel] [PATCH v2 3/3] iotests: Add test for map commands

2014-10-22 Thread Max Reitz
On 2014-10-22 at 16:48, Max Reitz wrote: On 2014-10-22 at 15:54, Max Reitz wrote: On 2014-10-22 at 15:51, Kevin Wolf wrote: Am 22.10.2014 um 15:24 hat Max Reitz geschrieben: Add a test for qemu-img map and qemu-io -c map on truncated files. Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf

[Qemu-devel] [PATCH v3 0/3] block: Fix is_allocated() for truncated images

2014-10-22 Thread Max Reitz
ge end for map' 003/3:[0002] [FC] 'iotests: Add test for map commands' Max Reitz (3): block: Respect underlying file's EOF qemu-io: Respect early image end for map iotests: Add test for map commands block.c| 15 ++

[Qemu-devel] [PATCH v3 3/3] iotests: Add test for map commands

2014-10-22 Thread Max Reitz
Add a test for qemu-img map and qemu-io -c map on truncated files. Signed-off-by: Max Reitz --- tests/qemu-iotests/102 | 64 ++ tests/qemu-iotests/102.out | 10 tests/qemu-iotests/group | 1 + 3 files changed, 75 insertions(+) create

[Qemu-devel] [PATCH v3 2/3] qemu-io: Respect early image end for map

2014-10-22 Thread Max Reitz
bdrv_is_allocated() may report zero clusters which most probably means the image (file) is shorter than expected. Respect this case in order to avoid an infinite loop. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet Reviewed-by: Kevin Wolf --- qemu-io-cmds.c | 5

[Qemu-devel] [PATCH v3 1/3] block: Respect underlying file's EOF

2014-10-22 Thread Max Reitz
: Max Reitz --- block.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index bbb04e7..88f6d9b 100644 --- a/block.c +++ b/block.c @@ -3954,13 +3954,24 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, if (bs->f

[Qemu-devel] [PATCH v3 2/3] raw-posix: raw_co_get_block_status() return value

2014-10-22 Thread Max Reitz
Wolf Signed-off-by: Max Reitz --- block/raw-posix.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index bd21fff..0058678 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1465,12 +1465,12 @@ out

[Qemu-devel] [PATCH v3 0/3] raw-posix: Fix raw_co_get_block_status()

2014-10-22 Thread Max Reitz
[FC] 'raw-posix: Fix raw_co_get_block_status() after EOF' 002/3:[0008] [FC] 'raw-posix: raw_co_get_block_status() return value' 003/3:[down] 'iotests: Add test for external image truncation' Max Reitz (3): raw-posix: Fix raw_co_get_block_status() after EOF raw-posix: raw

[Qemu-devel] [PATCH v3 1/3] raw-posix: Fix raw_co_get_block_status() after EOF

2014-10-22 Thread Max Reitz
end. This was probably not an issue if FIEMAP or SEEK_HOLE/SEEK_DATA worked, but the fallback did not take this case into account. Reported-by: Kevin Wolf Signed-off-by: Max Reitz --- block/raw-posix.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/block/raw

[Qemu-devel] [PATCH v3 3/3] iotests: Add test for external image truncation

2014-10-22 Thread Max Reitz
It should not be happening, but it is possible to truncate an image outside of qemu while qemu is running (or any of the qemu tools using the block layer. raw_co_get_block_status() should not break then. Signed-off-by: Max Reitz --- tests/qemu-iotests/102 | 15 +++ tests/qemu

Re: [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error

2014-10-23 Thread Max Reitz
On 2014-10-22 at 13:56, Kevin Wolf wrote: Am 21.10.2014 um 10:51 hat Max Reitz geschrieben: The bmap size in block/vdi.c may exceed INT_MAX. Using bdrv_pwrite_sync() (which takes an int byte count) is therefore not a good idea. The second patch of this series fixes this by replacing

Re: [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error

2014-10-23 Thread Max Reitz
On 2014-10-22 at 13:56, Kevin Wolf wrote: Am 21.10.2014 um 10:51 hat Max Reitz geschrieben: The bmap size in block/vdi.c may exceed INT_MAX. Using bdrv_pwrite_sync() (which takes an int byte count) is therefore not a good idea. The second patch of this series fixes this by replacing

Re: [Qemu-devel] [PATCH] snapshot: use local variable to bdrv_pwrite_sync L1 table

2014-10-23 Thread Max Reitz
On 2014-10-23 at 09:03, Kevin Wolf wrote: Am 23.10.2014 um 00:18 hat Eric Blake geschrieben: On 10/21/2014 03:24 AM, Max Reitz wrote: On 2014-10-21 at 10:04, Zhang Haoyu wrote: Use local variable to bdrv_pwrite_sync L1 table, needless to make conversion of cached L1 table between big-endian

Re: [Qemu-devel] [PATCH v3 3/3] iotests: Add test for external image truncation

2014-10-23 Thread Max Reitz
On 2014-10-22 at 18:50, Eric Blake wrote: On 10/22/2014 09:57 AM, Max Reitz wrote: It should not be happening, but it is possible to truncate an image outside of qemu while qemu is running (or any of the qemu tools using the block layer. raw_co_get_block_status() should not break then. Signed

Re: [Qemu-devel] [PATCH v3 1/3] raw-posix: Fix raw_co_get_block_status() after EOF

2014-10-23 Thread Max Reitz
On 2014-10-22 at 18:57, Eric Blake wrote: On 10/22/2014 09:57 AM, Max Reitz wrote: As its comment states, raw_co_get_block_status() should unconditionally return 0 and set *pnum to 0 for after EOF. An assertion after lseek(..., SEEK_HOLE) tried to catch this case by asserting that errno

Re: [Qemu-devel] [PATCH v3 1/3] raw-posix: Fix raw_co_get_block_status() after EOF

2014-10-23 Thread Max Reitz
On 2014-10-23 at 09:27, Max Reitz wrote: On 2014-10-22 at 18:57, Eric Blake wrote: On 10/22/2014 09:57 AM, Max Reitz wrote: As its comment states, raw_co_get_block_status() should unconditionally return 0 and set *pnum to 0 for after EOF. An assertion after lseek(..., SEEK_HOLE) tried to

Re: [Qemu-devel] [PATCH v3 2/3] raw-posix: raw_co_get_block_status() return value

2014-10-23 Thread Max Reitz
On 2014-10-22 at 19:00, Eric Blake wrote: On 10/22/2014 09:57 AM, Max Reitz wrote: Instead of generating the full return value thrice in try_fiemap(), try_seek_hole() and as a fall-back in raw_co_get_block_status() itself, generate the value only in raw_co_get_block_status(). While at it, also

Re: [Qemu-devel] [PATCH v3 3/3] iotests: Add test for external image truncation

2014-10-23 Thread Max Reitz
On 2014-10-23 at 09:46, Kevin Wolf wrote: Am 23.10.2014 um 09:26 hat Max Reitz geschrieben: On 2014-10-22 at 18:50, Eric Blake wrote: On 10/22/2014 09:57 AM, Max Reitz wrote: It should not be happening, but it is possible to truncate an image outside of qemu while qemu is running (or any of

Re: [Qemu-devel] [PATCH v13 03/14] qcow2: Optimize bdrv_make_empty()

2014-10-23 Thread Max Reitz
On 2014-10-22 at 20:35, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: bdrv_make_empty() is currently only called if the current image represents an external snapshot that has been committed to its base image; it is therefore unlikely to have internal snapshots. In this

Re: [Qemu-devel] [PATCH v13 03/14] qcow2: Optimize bdrv_make_empty()

2014-10-23 Thread Max Reitz
On 2014-10-23 at 10:29, Kevin Wolf wrote: Am 23.10.2014 um 09:46 hat Max Reitz geschrieben: On 2014-10-22 at 20:35, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: bdrv_make_empty() is currently only called if the current image represents an external snapshot that has been

Re: [Qemu-devel] [PATCH v13 03/14] qcow2: Optimize bdrv_make_empty()

2014-10-23 Thread Max Reitz
On 2014-10-23 at 10:41, Kevin Wolf wrote: Am 23.10.2014 um 10:36 hat Max Reitz geschrieben: On 2014-10-23 at 10:29, Kevin Wolf wrote: Am 23.10.2014 um 09:46 hat Max Reitz geschrieben: On 2014-10-22 at 20:35, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: bdrv_make_empty

Re: [Qemu-devel] [PATCH v13 03/14] qcow2: Optimize bdrv_make_empty()

2014-10-23 Thread Max Reitz
On 2014-10-23 at 11:42, Kevin Wolf wrote: Am 23.10.2014 um 11:11 hat Max Reitz geschrieben: Leaves the question, is it worth the hassle? Probably not. Would you be fine with setting bs->drv to NULL in the problematic error paths? By calling qcow2_signal_corruption(), right? I think tha

Re: [Qemu-devel] [PATCHv2 5/6] block: add qemu-iotest for write-merge parameter

2014-10-23 Thread Max Reitz
"bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.raw", "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", "device": "ide1

Re: [Qemu-devel] [PATCHv2 6/6] block: fix qemu-iotest reference output for test 067

2014-10-23 Thread Max Reitz
On 2014-10-22 at 15:22, Peter Lieven wrote: Output is changed by the addition of the write-merging parameter Signed-off-by: Peter Lieven --- tests/qemu-iotests/067.out | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) Reviewed-by: Max Reitz

Re: [Qemu-devel] [PATCH v13 06/14] iotests: Omit length/offset test in 040 and 041

2014-10-23 Thread Max Reitz
On 2014-10-23 at 12:06, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: As of a follow-up patch to this one, the length of a mirror block job will no longer directly depend on the size of the block device; therefore, drop these checks from this test. Instead, just check

Re: [Qemu-devel] [PATCHv4 1/4] util: introduce MIN_NON_ZERO

2014-10-23 Thread Max Reitz
/include/qemu/osdep.h @@ -68,6 +68,10 @@ typedef signed int int_fast16_t; #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif +#ifndef MIN_NON_ZERO +#define MIN_NON_ZERO(a, b) ((!!(a) && (a) < (b)) ? (a) : (b)) I contrast to Eric I'd even like (a) != 0 instead o

Re: [Qemu-devel] [PATCH v13 07/14] block/mirror: Improve progress report

2014-10-23 Thread Max Reitz
On 2014-10-23 at 12:52, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: Instead of taking the total length of the block device as the block job's length, use the number of dirty sectors. The progress is now the number of sectors mirrored to the target block device. Note

Re: [Qemu-devel] [PATCHv4 2/4] BlockLimits: introduce max_transfer_length

2014-10-23 Thread Max Reitz
On 2014-10-16 at 09:54, Peter Lieven wrote: Signed-off-by: Peter Lieven --- block.c |4 include/block/block_int.h |3 +++ 2 files changed, 7 insertions(+) Reviewed-by: Max Reitz

Re: [Qemu-devel] [PATCHv4 3/4] block/iscsi: set max_transfer_length

2014-10-23 Thread Max Reitz
On 2014-10-16 at 09:54, Peter Lieven wrote: the limit of 0xff for 16 byte CDBs is intentional to avoid overflows on 32-bit architectures. How is it related to 32 bit? I somehow feel like it has to do something with the result of sector_lun2qemu() which involves block_size... Signed-off-

Re: [Qemu-devel] [PATCHv4 4/4] block: avoid creating oversized writes in multiwrite_merge

2014-10-23 Thread Max Reitz
if (merge) { size_t size; QEMUIOVector *qiov = g_malloc0(sizeof(*qiov)); Reviewed-by: Max Reitz I feel like we should respect max_transfer_length in more than just this function, though. Every block device (or block driver) that sets a maximum transfer length should check re

Re: [Qemu-devel] [PATCH v13 08/14] qemu-img: Implement commit like QMP

2014-10-23 Thread Max Reitz
On 2014-10-23 at 13:59, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: qemu-img should use QMP commands whenever possible in order to ensure feature completeness of both online and offline image operations. As qemu-img itself has no access to QMP (since this would basically

Re: [Qemu-devel] [PATCH v13 08/14] qemu-img: Implement commit like QMP

2014-10-23 Thread Max Reitz
On 2014-10-23 at 14:40, Kevin Wolf wrote: Am 23.10.2014 um 14:35 hat Max Reitz geschrieben: On 2014-10-23 at 13:59, Kevin Wolf wrote: Am 22.10.2014 um 14:51 hat Max Reitz geschrieben: qemu-img should use QMP commands whenever possible in order to ensure feature completeness of both online and

Re: [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error

2014-10-23 Thread Max Reitz
On 2014-10-23 at 09:07, Max Reitz wrote: On 2014-10-22 at 13:56, Kevin Wolf wrote: Am 21.10.2014 um 10:51 hat Max Reitz geschrieben: The bmap size in block/vdi.c may exceed INT_MAX. Using bdrv_pwrite_sync() (which takes an int byte count) is therefore not a good idea. The second patch of this

[Qemu-devel] [PATCH] qemu-img: Print error if check failed

2014-10-23 Thread Max Reitz
bdrv_check() could not even complete with 0 as a return value, qemu-img check should inform the user about the error. Signed-off-by: Max Reitz --- qemu-img.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 09e7e72..731502c 100644

Re: [Qemu-devel] [PATCH] qemu-img: Print error if check failed

2014-10-23 Thread Max Reitz
On 2014-10-23 at 15:51, Eric Blake wrote: On 10/23/2014 07:29 AM, Max Reitz wrote: Currently, if bdrv_check() fails either by returning -errno or having check_errors set, qemu-img check just exits with 1 after having told the user that there were no errors on the image. This is bad. Instead of

[Qemu-devel] [PATCH 1/2] block: JSON filenames and relative backing files

2014-10-23 Thread Max Reitz
for the backing file of BDSs only having a JSON filename. Signed-off-by: Max Reitz --- Just by the way, the reason for using bs->exact_filename in bdrv_get_full_backing_filename() instead of just testing whether bs->filename is prefixed by "json:" is that in the future we might hav

[Qemu-devel] [PATCH 0/2] block: JSON filenames and relative backing files

2014-10-23 Thread Max Reitz
ather just print an error and bail out. Max Reitz (2): block: JSON filenames and relative backing files iotests: Add test for relative backing file names block.c| 19 +++--- block/qapi.c | 7 +++- include/block/block.h | 2 +- tests/qemu-iotest

[Qemu-devel] [PATCH 2/2] iotests: Add test for relative backing file names

2014-10-23 Thread Max Reitz
Sometimes, qemu does not have a filename to work with, so it does not know which directory to use for a backing file specified by a relative filename. Add a test which tests that qemu exits with an appropriate error message. Signed-off-by: Max Reitz --- tests/qemu-iotests/110 | 87

Re: [Qemu-devel] [PATCH] qemu-img: Print error if check failed

2014-10-23 Thread Max Reitz
On 2014-10-23 at 15:29, Max Reitz wrote: Currently, if bdrv_check() fails either by returning -errno or having check_errors set, qemu-img check just exits with 1 after having told the user that there were no errors on the image. This is bad. Instead of printing the check result if there were

Re: [Qemu-devel] [PATCH v5] snapshot: use local variable to bdrv_pwrite_sync L1 table

2014-10-23 Thread Max Reitz
On 22.10.2014 14:39, Zhang Haoyu wrote: Use local variable to bdrv_pwrite_sync L1 table, needless to make conversion of cached L1 table between big-endian and host style. Signed-off-by: Zhang Haoyu Reviewed-by: Max Reitz --- v4 -> v5: - delete superfluous check of "l1_size2 != 0&q

Re: [Qemu-devel] [PATCH v5] snapshot: use local variable to bdrv_pwrite_sync L1 table

2014-10-23 Thread Max Reitz
On 22.10.2014 14:39, Zhang Haoyu wrote: Use local variable to bdrv_pwrite_sync L1 table, needless to make conversion of cached L1 table between big-endian and host style. Signed-off-by: Zhang Haoyu Reviewed-by: Max Reitz --- v4 -> v5: - delete superfluous check of "l1_size2 != 0&q

Re: [Qemu-devel] [PATCH 1/2] block: JSON filenames and relative backing files

2014-10-23 Thread Max Reitz
On 23.10.2014 19:42, Eric Blake wrote: On 10/23/2014 08:56 AM, Max Reitz wrote: When using a relative backing file name, qemu needs to know the directory of the top image file. For JSON filenames, such a directory cannot be easily determined (e.g. how do you determine the directory of a qcow2

[Qemu-devel] [PATCH v4 3/3] iotests: Add test for external image truncation

2014-10-24 Thread Max Reitz
_IMG convert -f raw". Signed-off-by: Max Reitz --- tests/qemu-iotests/102 | 21 +++-- tests/qemu-iotests/102.out | 11 +++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index 34b363f..161b197 100

[Qemu-devel] [PATCH v4 0/3] raw-posix: Fix raw_co_get_block_status()

2014-10-24 Thread Max Reitz
posix: Fix raw_co_get_block_status() after EOF' 002/3:[] [-C] 'raw-posix: raw_co_get_block_status() return value' 003/3:[0021] [FC] 'iotests: Add test for external image truncation' Max Reitz (3): raw-posix: Fix raw_co_get_block_status() after EOF raw-posix: raw_co_get_block_status() r

[Qemu-devel] [PATCH v4 1/3] raw-posix: Fix raw_co_get_block_status() after EOF

2014-10-24 Thread Max Reitz
end. This was probably not an issue if FIEMAP or SEEK_HOLE/SEEK_DATA worked, but the fallback did not take this case into account. Reported-by: Kevin Wolf Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- block/raw-posix.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-)

[Qemu-devel] [PATCH v4 2/3] raw-posix: raw_co_get_block_status() return value

2014-10-24 Thread Max Reitz
Wolf Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- block/raw-posix.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index a86b784..e100ae2 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c

[Qemu-devel] [PATCH v14 00/14] qemu-img: Implement commit like QMP

2014-10-24 Thread Max Reitz
mu-img: Implement commit like QMP' 009/14:[] [--] 'qemu-img: Empty image after commit' 010/14:[0001] [FC] 'qemu-img: Enable progress output for commit' 011/14:[0019] [FC] 'qemu-img: Specify backing file for commit' 012/14:[----] [--] 'iotests: Add _fi

[Qemu-devel] [PATCH v14 03/14] qcow2: Optimize bdrv_make_empty()

2014-10-24 Thread Max Reitz
the dirty flag set, which only works for compat=1.1) and creating a trivial refcount structure. If there are snapshots or for compat=0.10, fall back to the simple implementation (discard all clusters). Signed-off-by: Max Reitz --- block/blkdebug.c | 2 + block/qcow2.c | 165

[Qemu-devel] [PATCH v14 02/14] qcow2: Implement bdrv_make_empty()

2014-10-24 Thread Max Reitz
Implement this function by making all clusters in the image file fall through to the backing file (by using the recently extended discard). Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- block/qcow2.c | 27 +++ 1 file changed, 27

[Qemu-devel] [PATCH v14 07/14] block/mirror: Improve progress report

2014-10-24 Thread Max Reitz
er in fact desirable. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- block/mirror.c | 34 ++ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index e8a43eb..2a1acfe 100644 --- a/block/mirr

[Qemu-devel] [PATCH v14 01/14] qcow2: Allow "full" discard

2014-10-24 Thread Max Reitz
Normally, discarded sectors should read back as zero. However, there are cases in which a sector (or rather cluster) should be discarded as if they were never written in the first place, that is, reading them should fall through to the backing file again. Signed-off-by: Max Reitz Reviewed-by

[Qemu-devel] [PATCH v14 04/14] blockjob: Introduce block_job_complete_sync()

2014-10-24 Thread Max Reitz
Implement block_job_complete_sync() by doing the exact same thing as block_job_cancel_sync() does, only with calling block_job_complete() instead of block_job_cancel(). Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf --- blockjob.c | 39

[Qemu-devel] [PATCH v14 06/14] iotests: Omit length/offset test in 040 and 041

2014-10-24 Thread Max Reitz
function from iotests.py, the same applies there as well which in turn affects tests 030, 055 and 056. On the other hand, a block job's length does not have to be related to the length of the image file in the first place, so that check was questionable anyway. Signed-off-by: Max Reitz --- tests

[Qemu-devel] [PATCH v14 11/14] qemu-img: Specify backing file for commit

2014-10-24 Thread Max Reitz
Introduce a new parameter for qemu-img commit which may be used to explicitly specify the backing file into which an image should be committed if the backing chain has more than a single layer. Signed-off-by: Max Reitz --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 32

[Qemu-devel] [PATCH v14 10/14] qemu-img: Enable progress output for commit

2014-10-24 Thread Max Reitz
Implement progress output for the commit command by querying the progress of the block job. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 23 +-- qemu-img.texi| 2 +- 3 files changed, 24

[Qemu-devel] [PATCH v14 05/14] blockjob: Add "ready" field

2014-10-24 Thread Max Reitz
ck job may be completed. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- blockjob.c | 3 +++ include/block/blockjob.h | 5 + qapi/block-core.json | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/blockjob.c b/blockjob.c ind

[Qemu-devel] [PATCH v14 09/14] qemu-img: Empty image after commit

2014-10-24 Thread Max Reitz
After the top image has been committed, it should be emptied unless specified otherwise. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 34 +++--- qemu-img.texi| 6 +- 3 files

[Qemu-devel] [PATCH v14 13/14] iotests: Add test for backing-chain commits

2014-10-24 Thread Max Reitz
Add a test for qemu-img commit on backing chains with more than two images. This test also checks whether the top image is emptied (unless this is prevented by specifying either -d or -b) and does therefore not work for qed and vmdk which requires it to be separate from 020. Signed-off-by: Max

[Qemu-devel] [PATCH v14 08/14] qemu-img: Implement commit like QMP

2014-10-24 Thread Max Reitz
block-commit by using commit_active_start() and then waiting for the block job to finish. Signed-off-by: Max Reitz --- block/Makefile.objs | 3 +-- qemu-img.c | 78 - 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/

[Qemu-devel] [PATCH v14 14/14] iotests: Add test for qcow2's bdrv_make_empty

2014-10-24 Thread Max Reitz
Add a test for qcow2's fast bdrv_make_empty implementation on images without internal snapshots. Signed-off-by: Max Reitz --- tests/qemu-iotests/098 | 82 ++ tests/qemu-iotests/098.out | 52 + tests/qemu-iotests/

[Qemu-devel] [PATCH v14 12/14] iotests: Add _filter_qemu_img_map

2014-10-24 Thread Max Reitz
As different image formats most probably map guest addresses to different host addresses, add a filter to filter the host addresses out; also, the image filename should be filtered. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- tests/qemu-iotests/common.filter

Re: [Qemu-devel] [PATCH v14 14/14] iotests: Add test for qcow2's bdrv_make_empty

2014-10-27 Thread Max Reitz
On 2014-10-24 at 18:31, Eric Blake wrote: On 10/24/2014 07:57 AM, Max Reitz wrote: Add a test for qcow2's fast bdrv_make_empty implementation on images without internal snapshots. Signed-off-by: Max Reitz --- tests/qemu-iotests/098

Re: [Qemu-devel] [question] How is the progress of optimizing qcow2_check_metadata_overlap() with reagard to cpu overhead?

2014-10-27 Thread Max Reitz
On 2014-10-25 at 09:00, Zhang Haoyu wrote: Hi, Max How is the progress of optimizing qcow2_check_metadata_overlap? http://thread.gmane.org/gmane.comp.emulators.kvm.devel/127037/focus=127364 Thanks, Zhang Haoyu Hi Zhang Haoyu, there are still a couple of upstream series I've worked o

Re: [Qemu-devel] [PATCH] block: qemu-iotest 107 supports NFS

2014-10-27 Thread Max Reitz
On 2014-10-25 at 17:05, Peter Lieven wrote: As discussed during review a follow up for Max's fix. Signed-off-by: Peter Lieven --- tests/qemu-iotests/107 |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Max Reitz

Re: [Qemu-devel] [PATCHv4 3/4] block/iscsi: set max_transfer_length

2014-10-27 Thread Max Reitz
On 2014-10-25 at 17:16, Peter Lieven wrote: Am 23.10.2014 um 13:18 schrieb Max Reitz: On 2014-10-16 at 09:54, Peter Lieven wrote: the limit of 0xff for 16 byte CDBs is intentional to avoid overflows on 32-bit architectures. How is it related to 32 bit? I somehow feel like it has to do

Re: [Qemu-devel] [PATCHv5 1/6] util: introduce MIN_NON_ZERO

2014-10-27 Thread Max Reitz
/include/qemu/osdep.h @@ -68,6 +68,12 @@ typedef signed int int_fast16_t; #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif +/* Minimum function that returns zero only iff both values are zero. + * Intended for use with unsigned values only. */ +#ifndef MIN_NON_ZERO +#def

Re: [Qemu-devel] [PATCHv5 3/6] block/iscsi: set max_transfer_length

2014-10-27 Thread Max Reitz
n); + if (iscsilun->lbp.lbpu) { if (iscsilun->bl.max_unmap < 0x) { bs->bl.max_discard = sector_lun2qemu(iscsilun->bl.max_unmap, Hm, seems strange to have a function called nb_sectors_lun2qemu() not only convert values, but also cap the result. But anyway: Reviewed-by: Max Reitz

Re: [Qemu-devel] [PATCHv5 5/6] block/iscsi: limit to INT_MAX throughout iscsi_refresh_limits

2014-10-27 Thread Max Reitz
On 2014-10-25 at 18:18, Peter Lieven wrote: As Max pointed out there is a hidden cast from int64_t to int. So use the newly introduced nb_sectors_lun2qemu for all limits. Signed-off-by: Peter Lieven --- block/iscsi.c | 20 ++-- 1 file changed, 10 insertions(+), 10

Re: [Qemu-devel] [PATCHv5 6/6] block/iscsi: check for oversized requests

2014-10-27 Thread Max Reitz
On 2014-10-25 at 18:18, Peter Lieven wrote: Cancel oversized requests early. They would generate an iSCSI protocol error anyway; after having transferred possibly a lot of data over the wire. Suggested-By: Max Reitz Signed-off-by: Peter Lieven --- block/iscsi.c | 12 1 file

Re: [Qemu-devel] [PATCHv5 5/6] block/iscsi: limit to INT_MAX throughout iscsi_refresh_limits

2014-10-27 Thread Max Reitz
On 2014-10-27 at 09:35, Peter Lieven wrote: On 27.10.2014 09:32, Max Reitz wrote: On 2014-10-25 at 18:18, Peter Lieven wrote: As Max pointed out there is a hidden cast from int64_t to int. So use the newly introduced nb_sectors_lun2qemu for all limits. Signed-off-by: Peter Lieven --- block

Re: [Qemu-devel] [PATCHv5 3/6] block/iscsi: set max_transfer_length

2014-10-27 Thread Max Reitz
On 2014-10-27 at 09:36, Peter Lieven wrote: On 27.10.2014 09:28, Max Reitz wrote: On 2014-10-25 at 18:18, Peter Lieven wrote: Copy the max_xfer_len from the BlockLimits VPD or use the maximum value fitting in the CDB. Signed-off-by: Peter Lieven --- block/iscsi.c | 17

Re: [Qemu-devel] [PATCHv3 1/6] block: add accounting for merged requests

2014-10-27 Thread Max Reitz
-core.json |7 ++- 6 files changed, 22 insertions(+), 2 deletions(-) Reviewed-by: Max Reitz

Re: [Qemu-devel] [PATCHv5 3/6] block/iscsi: set max_transfer_length

2014-10-27 Thread Max Reitz
On 2014-10-27 at 09:47, Peter Lieven wrote: On 27.10.2014 09:44, Max Reitz wrote: On 2014-10-27 at 09:36, Peter Lieven wrote: On 27.10.2014 09:28, Max Reitz wrote: On 2014-10-25 at 18:18, Peter Lieven wrote: Copy the max_xfer_len from the BlockLimits VPD or use the maximum value fitting in

Re: [Qemu-devel] [PATCHv3 5/6] block: add qemu-iotest for write-merge parameter

2014-10-27 Thread Max Reitz
(+) create mode 100755 tests/qemu-iotests/109 create mode 100644 tests/qemu-iotests/109.out First: Reviewed-by: Max Reitz Second: Why are you using query-block at all? Just give both the format and the protocol BDS a (different) node name and you could use only query-named-block-nodes. Max

Re: [Qemu-devel] [PATCH v14 11/14] qemu-img: Specify backing file for commit

2014-10-27 Thread Max Reitz
On 2014-10-24 at 18:23, Eric Blake wrote: On 10/24/2014 07:57 AM, Max Reitz wrote: Introduce a new parameter for qemu-img commit which may be used to explicitly specify the backing file into which an image should be committed if the backing chain has more than a single layer. Signed-off-by

Re: [Qemu-devel] [PATCHv6 3/6] block/iscsi: set max_transfer_length

2014-10-27 Thread Max Reitz
is the range for nb_sectors throughout the block layer. Signed-off-by: Peter Lieven --- block/iscsi.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) Okay, I think finding the comment in the commit message through git blame is reasonable. Reviewed-by: Max Reitz

Re: [Qemu-devel] [PATCHv6 5/6] block/iscsi: use sector_limits_lun2qemu throughout iscsi_refresh_limits

2014-10-27 Thread Max Reitz
On 2014-10-27 at 10:18, Peter Lieven wrote: As Max pointed out there is a hidden cast from int64_t to int for all limits. So use the newly introduced sector_limits_lun2qemu for all limits received from the target. Signed-off-by: Peter Lieven --- block/iscsi.c | 20 ++-- 1

[Qemu-devel] [PATCH v4 2/7] qemu-img: Add progress output for amend

2014-10-27 Thread Max Reitz
Now that bdrv_amend_options() supports a status callback, use it to display a progress report. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet --- qemu-img-cmds.hx | 4 ++-- qemu-img.c | 25 ++--- qemu-img.texi| 2 +- 3 files changed

[Qemu-devel] [PATCH v4 0/7] block/qcow2: Improve zero cluster expansion

2014-10-27 Thread Max Reitz
block/qcow2: Make get_refcount() global' 006/7:[0006] [FC] 'block/qcow2: Simplify shared L2 handling in amend' 007/7:[] [--] 'iotests: Expand test 061' Max Reitz (7): block: Add status callback to bdrv_amend_options() qemu-img: Add progress output for amend qemu

[Qemu-devel] [PATCH v4 1/7] block: Add status callback to bdrv_amend_options()

2014-10-27 Thread Max Reitz
l. A callback may not be very pretty, but it's very easy to implement and perfectly fits its purpose here. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet --- block.c | 5 +++-- block/qcow2.c | 3 ++- include/block/block.h | 8 +++

[Qemu-devel] [PATCH v4 3/7] qemu-img: Fix insignificant memleak

2014-10-27 Thread Max Reitz
As soon as options is set in img_amend(), it needs to be freed before the function returns. This leak is rather insignificant, as qemu-img will exit subsequently anyway, but there's no point in not fixing it. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoit Canet ---

[Qemu-devel] [PATCH v4 5/7] block/qcow2: Make get_refcount() global

2014-10-27 Thread Max Reitz
or 1; any value is fine. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet --- block/qcow2-refcount.c | 26 +- block/qcow2.h | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-

[Qemu-devel] [PATCH v4 6/7] block/qcow2: Simplify shared L2 handling in amend

2014-10-27 Thread Max Reitz
allocated for expansion. This will be the correct refcount and therefore we don't have to remember that cluster having been allocated any more. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet --- block/qcow2-cluster.c

[Qemu-devel] [PATCH v4 7/7] iotests: Expand test 061

2014-10-27 Thread Max Reitz
Add some tests for progress output to 061. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet --- tests/qemu-iotests/061 | 25 + tests/qemu-iotests/061.out | 30 ++ tests/qemu-iotests/group | 2 +- 3 files

[Qemu-devel] [PATCH v4 4/7] block/qcow2: Implement status CB for amend

2014-10-27 Thread Max Reitz
the number of L1 entries visited during the operation. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet --- block/qcow2-cluster.c | 37 + block/qcow2.c | 7 --- block/qcow2.h | 3 ++- 3 files changed, 39

[Qemu-devel] [PATCH] block/vdi: Limit maximum size even futher

2014-10-27 Thread Max Reitz
(down to approximately 512 TB). The VDI test 084 has to be adapted accordingly. Actually, one could clearly see that it was broken from the "Could not open 'TEST_DIR/t.IMGFMT': Invalid argument" line for an image which was supposed to work just fine. Signed-off-by: Max Reitz

Re: [Qemu-devel] [PATCH] block/vdi: Limit maximum size even futher

2014-10-27 Thread Max Reitz
On 2014-10-27 at 12:10, Peter Lieven wrote: On 27.10.2014 11:56, Max Reitz wrote: The block layer read and write functions do not like requests which are bigger than INT_MAX bytes. Since the VDI bmap is read and written in a single operation, its size is therefore limited accordingly. This

Re: [Qemu-devel] [PATCH] block/vdi: Limit maximum size even futher

2014-10-27 Thread Max Reitz
On 2014-10-27 at 12:39, Max Reitz wrote: On 2014-10-27 at 12:10, Peter Lieven wrote: On 27.10.2014 11:56, Max Reitz wrote: The block layer read and write functions do not like requests which are bigger than INT_MAX bytes. Since the VDI bmap is read and written in a single operation, its size

[Qemu-devel] [PATCH 0/2] block: Propagate error in bdrv_img_create()

2014-10-27 Thread Max Reitz
ory: No such file or directory Just propagating the error is sufficient: $ qemu-img create -f qcow2 -b /tmp/enoent /tmp/img.qcow2 qemu-img /tmp/img.qcow2: Could not open '/tmp/enoent': No such file or directory Max Reitz (2): block: Propagate error in bdrv_img_create() iotests: Add test

[Qemu-devel] [PATCH 2/2] iotests: Add test for non-existing backing file

2014-10-27 Thread Max Reitz
Test the error message when a COW file is about to be created which is supposed to inherit the size of its backing file, while the backing file given does not actually exist. Signed-off-by: Max Reitz --- tests/qemu-iotests/111 | 53 ++ tests/qemu

[Qemu-devel] [PATCH 1/2] block: Propagate error in bdrv_img_create()

2014-10-27 Thread Max Reitz
If the specified backing file could not be opened, do not generate a new error message which contains the message which has been generated by bdrv_open(), but just propagate the latter. Signed-off-by: Max Reitz --- block.c | 5 - 1 file changed, 5 deletions(-) diff --git a/block.c b

Re: [Qemu-devel] [PATCH 2/2] iotests: Add test for non-existing backing file

2014-10-28 Thread Max Reitz
On 2014-10-27 at 18:14, Eric Blake wrote: On 10/27/2014 06:30 AM, Max Reitz wrote: Test the error message when a COW file is about to be created which is supposed to inherit the size of its backing file, while the backing file given does not actually exist. Signed-off-by: Max Reitz

Re: [Qemu-devel] [PATCH v2 1/2] hw/core/loader: implement address translation in uimage loader

2014-10-28 Thread Max Filippov
Hi, On Sun, Oct 19, 2014 at 8:04 AM, Max Filippov wrote: > Such address translation is needed when load address recorded in uImage > is a virtual address. When the actual load address is requested, return > untranslated address: user that needs the translated address can alway

[Qemu-devel] [PATCH v2] block/vdi: Limit maximum size even futher

2014-10-28 Thread Max Reitz
(down to approximately 512 TB). The VDI test 084 has to be adapted accordingly. Actually, one could clearly see that it was broken from the "Could not open 'TEST_DIR/t.IMGFMT': Invalid argument" line for an image which was supposed to work just fine. Signed-off-by: Max Reitz --

Re: [Qemu-devel] [PATCHv3 2/6] block: introduce bdrv_runtime_opts

2014-10-28 Thread Max Reitz
in bdrv_open_common. Signed-off-by: Kevin Wolf Signed-off-by: Peter Lieven Reviewed-by: Max Reitz --- block.c | 38 +- 1 file changed, 33 insertions(+), 5 deletions(-) Is this purely because the QemuOptsList API is more convenient than qdict? I don'

Re: [Qemu-devel] [PATCH v4 7/7] iotests: Expand test 061

2014-10-28 Thread Max Reitz
On 2014-10-28 at 17:38, Kevin Wolf wrote: Am 27.10.2014 um 11:12 hat Max Reitz geschrieben: Add some tests for progress output to 061. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoît Canet diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 9bbd5d3

Re: [Qemu-devel] [PATCH RFC 2/2] block: Warn on insecure format probing

2014-10-29 Thread Max Reitz
want to warn anyway just so the user knows that he/she should rename the image file. So for me it comes down to what is easier, and I think just always emitting the warning is easier. Max I was about to propose these two rules as something I'd still feel more comfortable with: if it is

Re: [Qemu-devel] [PATCH 1/4] block: Add bdrv_next_node

2014-10-29 Thread Max Reitz
could reuse this for bdrv_named_nodes_list(), but that's optional. Reviewed-by: Max Reitz

<    4   5   6   7   8   9   10   11   12   13   >