[Qemu-block] [PATCH v5 0/9] discard blockstats

2018-10-31 Thread Anton Nefedov
new in v5: - new patch 3. Protects from double-accounting IDE trim requests in ide_handle_rw_error(). - patch 4: move block_acct_invalid() for unmap to ide_issue_trim_cb() This way it doesn't affect read and write requests. - patch 7: added missing hunks as suggested by

[Qemu-block] [PATCH v5 5/9] scsi: store unmap offset and nb_sectors in request struct

2018-10-31 Thread Anton Nefedov
it allows to report it in the error handler Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- hw/scsi/scsi-disk.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c

[Qemu-block] [PATCH v5 2/9] qapi: add unmap to BlockDeviceStats

2018-10-31 Thread Anton Nefedov
Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake --- qapi/block-core.json | 29 +++-- include/block/accounting.h | 1 + block/qapi.c | 6 ++ tests/qemu-iotests/227.out |

[Qemu-block] [PATCH v5 1/9] qapi: group BlockDeviceStats fields

2018-10-31 Thread Anton Nefedov
Make the stat fields definition slightly more readable. Also reorder total_time_ns stats read-write-flush as done elsewhere. Cosmetic change only. Signed-off-by: Anton Nefedov --- qapi/block-core.json | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git

[Qemu-block] [PATCH v5 4/9] ide: account UNMAP (TRIM) operations

2018-10-31 Thread Anton Nefedov
Signed-off-by: Anton Nefedov --- hw/ide/core.c | 12 1 file changed, 12 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 04e22e751d..8da77ff3e3 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -441,6 +441,14 @@ static void ide_issue_trim_cb(void *opaque, int ret)

Re: [Qemu-block] [Qemu-devel] [PATCH v2] file-posix: Use error API properly

2018-10-31 Thread Markus Armbruster
Fam Zheng writes: > Use error_report for situations that affect user operation (i.e. we're > actually returning error), and warn_report/warn_report_err when some > less critical error happened but the user operation can still carry on. > > For raw_normalize_devicepath, add Error parameter to

Re: [Qemu-block] [Qemu-devel] [PATCH v2] file-posix: Use error API properly

2018-10-31 Thread Philippe Mathieu-Daudé
On 31/10/18 15:57, Eric Blake wrote: On 10/31/18 12:39 AM, Fam Zheng wrote: ... -    fprintf(stderr, "%s: stat failed: %s\n", -    fname, strerror(errno)); +    error_setg(errp, "%s: stat failed: %s", fname, strerror(errno));   return -errno; error_setg_errno() is

Re: [Qemu-block] [Qemu-devel] [PATCH v2] file-posix: Use error API properly

2018-10-31 Thread Eric Blake
On 10/31/18 12:39 AM, Fam Zheng wrote: Use error_report for situations that affect user operation (i.e. we're actually returning error), and warn_report/warn_report_err when some less critical error happened but the user operation can still carry on. For raw_normalize_devicepath, add Error

[Qemu-block] [PATCH 2/2] Discard blocks while copy-on-read

2018-10-31 Thread Andrey Shinkevich
Discards the block duplicated in an intermediate backing file after the block have been copied into the active layer during QMP block-stream operation. It saves the disk space while merging snapshots. Signed-off-by: Andrey Shinkevich --- block/stream.c | 400

[Qemu-block] [PATCH 1/2] The discard flag for block stream operation

2018-10-31 Thread Andrey Shinkevich
Adding a parameter to QMP block-stream command to allow discarding blocks in the backing chain while blocks are being copied to the active layer. Signed-off-by: Andrey Shinkevich --- block/stream.c| 2 +- blockdev.c| 8 +++- hmp-commands.hx | 4 ++--

[Qemu-block] [PATCH 0/2] Discrad blocks during block-stream operation

2018-10-31 Thread Andrey Shinkevich
Hello everyone! The given feature discards blocks with copy-on-read operation while the streaming process runs. Adding the 'discard' argument to the QMP block-stream command allows dropping a block in the backing chain after it has been copied to the active layer. That will elude the block

Re: [Qemu-block] [Qemu-devel] [PATCH v2] file-posix: Use error API properly

2018-10-31 Thread Eric Blake
On 10/31/18 11:05 AM, Philippe Mathieu-Daudé wrote: On 31/10/18 15:57, Eric Blake wrote: On 10/31/18 12:39 AM, Fam Zheng wrote: ... -    fprintf(stderr, "%s: stat failed: %s\n", -    fname, strerror(errno)); +    error_setg(errp, "%s: stat failed: %s", fname,

Re: [Qemu-block] [PATCH 1/2] The discard flag for block stream operation

2018-10-31 Thread Dr. David Alan Gilbert
* Andrey Shinkevich (andrey.shinkev...@virtuozzo.com) wrote: > Adding a parameter to QMP block-stream command to allow discarding > blocks in the backing chain while blocks are being copied to the > active layer. > > Signed-off-by: Andrey Shinkevich > --- > block/stream.c| 2 +- >

[Qemu-block] [PATCH 0/2] Update the inherits_from pointer after stream and commit

2018-10-31 Thread Alberto Garcia
Hi all, when you open an image [A] with a few more images on the backing chain you get something like this: [E] <- [D] <- [C] <- [B] <- [A] Here you can go from [A] to [E] by following the bs->backing pointer. At the same time each one of the backing files has an 'inherits_from' attribute

[Qemu-block] [PATCH 1/2] block: Update BlockDriverState.inherits_from on bdrv_set_backing_hd()

2018-10-31 Thread Alberto Garcia
When a BlockDriverState's child is opened (be it a backing file, the protocol layer, or any other) inherits_from is set to point to the parent node. Children opened separately and then attached to a parent don't have this pointer set. bdrv_reopen_queue_child() uses this to determine whether a

[Qemu-block] [PATCH 2/2] block: Update BlockDriverState.inherits_from on bdrv_drop_intermediate()

2018-10-31 Thread Alberto Garcia
The previous patch fixed the inherits_from pointer after block-stream, and this one does the same for block-commit. When block-commit finishes and the 'top' node is not the topmost one from the backing chain then all nodes above 'base' up to and including 'top' are removed from the chain. The

Re: [Qemu-block] [PATCH v4 02/11] block: Add auto-read-only option

2018-10-31 Thread Kevin Wolf
Am 19.10.2018 um 18:30 hat Kevin Wolf geschrieben: > If a management application builds the block graph node by node, the > protocol layer doesn't inherit its read-only option from the format > layer any more, so it must be set explicitly. > > Backing files should work on read-only storage, but

Re: [Qemu-block] [PATCH v4 00/11] block: Add auto-read-only option

2018-10-31 Thread Kevin Wolf
Am 19.10.2018 um 18:30 hat Kevin Wolf geschrieben: > See patch 2 for an explanation of the motivation. > > v4: > - Split fix for missing rbd_close() into a separate patch [Eric] > - Added qemu-iotests case > > v3: > - Clarified QAPI schema documentation that auto-read-only can only > degrade

[Qemu-block] [PATCH 02/12] file-posix: Factor out raw_thread_pool_submit()

2018-10-31 Thread Kevin Wolf
Getting the thread pool of the AioContext of a block node and scheduling some work in it is an operation that is already done twice, and we'll get more instances. Factor it out into a separate function. Signed-off-by: Kevin Wolf --- block/file-posix.c | 17 ++--- 1 file changed, 10

[Qemu-block] [PATCH 01/12] file-posix: Reorganise RawPosixAIOData

2018-10-31 Thread Kevin Wolf
RawPosixAIOData contains a lot of fields for several separate operations that are to be processed in a worker thread and that need different parameters. The struct is currently rather unorganised, with unions that cover some, but not all operations, and even one #define for field names instead of

[Qemu-block] [PATCH 00/12] file-posix: Simplify delegation to worker thread

2018-10-31 Thread Kevin Wolf
This series cleans up and simplifies the code that calls worker thread functions for the various operations in the file-posix driver. This results in less indirection and better readability as well as reduced heap allocations because we can store ACBs on the coroutine stack now. Kevin Wolf (12):

[Qemu-block] [PATCH 05/12] file-posix: Avoid aio_worker() for QEMU_AIO_WRITE_ZEROES

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 10/12] file-posix: Remove paio_submit_co()

2018-10-31 Thread Kevin Wolf
The function is not used any more, remove it. Signed-off-by: Kevin Wolf --- block/file-posix.c | 34 -- 1 file changed, 34 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index c5e83140d3..821743d2b2 100644 --- a/block/file-posix.c +++

[Qemu-block] [PATCH 06/12] file-posix: Avoid aio_worker() for QEMU_AIO_DISCARD

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 03/12] file-posix: Avoid aio_worker() for QEMU_AIO_TRUNCATE

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 07/12] file-posix: Avoid aio_worker() for QEMU_AIO_FLUSH

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 09/12] file-posix: Avoid aio_worker() for QEMU_AIO_READ/WRITE

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 12/12] file-posix: Avoid aio_worker() for QEMU_AIO_IOCTL

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 08/12] file-posix: Move read/write operation logic out of aio_worker()

2018-10-31 Thread Kevin Wolf
aio_worker() for reads and writes isn't boring enough yet. It still does some postprocessing for handling short reads and turning the result into the right return value. However, there is no reason why handle_aiocb_rw() couldn't do the same, and even without duplicating code between the read and

[Qemu-block] [PATCH 04/12] file-posix: Avoid aio_worker() for QEMU_AIO_COPY_RANGE

2018-10-31 Thread Kevin Wolf
aio_worker() doesn't add anything interesting, it's only a useless indirection. Call the handler function directly instead. As we know that this handler function is only called from coroutine context and the coroutine stays around until the worker thread finishes, we can keep RawPosixAIOData on

[Qemu-block] [PATCH 11/12] file-posix: Switch to .bdrv_co_ioctl

2018-10-31 Thread Kevin Wolf
No real reason to keep using the callback based mechanism here when the rest of the file-posix driver is coroutine based. Changing it brings ioctls more in line with how other request types work. Signed-off-by: Kevin Wolf --- include/scsi/pr-manager.h | 8 +++- block/file-posix.c|

Re: [Qemu-block] [Qemu-devel] [PULL 00/15] Python queue, 2018-10-30

2018-10-31 Thread no-reply
Hi, This series seems to have some coding style problems. See output below for more information: Type: series Message-id: 20181031003120.26771-1-ehabk...@redhat.com Subject: [Qemu-devel] [PULL 00/15] Python queue, 2018-10-30 === TEST SCRIPT BEGIN === #!/bin/bash BASE=base n=1 total=$(git log

[Qemu-block] [PATCH v5 8/9] file-posix: account discard operations

2018-10-31 Thread Anton Nefedov
This will help to identify how many of the user-issued discard operations (accounted on a device level) have actually suceeded down on the host file (even though the numbers will not be exactly the same if non-raw format driver is used (e.g. qcow2 sending metadata discards)). Note that these

[Qemu-block] [PATCH v5 6/9] scsi: move unmap error checking to the complete callback

2018-10-31 Thread Anton Nefedov
This will help to account the operation in the following commit. The difference is that we don't call scsi_disk_req_check_error() before the 1st discard iteration anymore. That function also checks if the request is cancelled, however it shouldn't get canceled until it yields in blk_aio()

[Qemu-block] [PATCH v5 7/9] scsi: account unmap operations

2018-10-31 Thread Anton Nefedov
Signed-off-by: Anton Nefedov --- hw/scsi/scsi-disk.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index e132504913..dee71f9dde 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1663,10 +1663,16 @@ static

[Qemu-block] [PATCH v5 9/9] qapi: query-blockstat: add driver specific file-posix stats

2018-10-31 Thread Anton Nefedov
A block driver can provide a callback to report driver-specific statistics. file-posix driver now reports discard statistics Signed-off-by: Anton Nefedov --- qapi/block-core.json | 39 +++ include/block/block.h | 1 + include/block/block_int.h | 1

[Qemu-block] [PATCH v5 3/9] block: add empty account cookie type

2018-10-31 Thread Anton Nefedov
This adds some protection from accounting unitialized cookie. That is, block_acct_failed/done without previous block_acct_start; in that case, cookie probably holds values from previous operation. (Note: it might also be unitialized holding garbage value and there is still "< BLOCK_MAX_IOTYPE"

[Qemu-block] [PATCH] iotests: 082: Update output

2018-10-31 Thread Fam Zheng
Commit 9cbef9d68e (qemu-option: improve qemu_opts_print_help() output) affected qemu-img help output, and broke this test case. Update the output reference to fix it. Signed-off-by: Fam Zheng --- I'm once again looking at enabling iotests on patchew (via vm based tests), but immediately got

[Qemu-block] ping2 Re: [PATCH 0/2] replication: drop extra sync

2018-10-31 Thread Vladimir Sementsov-Ogievskiy
ping2 Hi, it's a first step to backup refactoring and improving. Just get rid of this extra and unnatural synchronization. 19.09.2018 15:43, Vladimir Sementsov-Ogievskiy wrote: > Hi all! > > We finally implemented fleecing scheme, create a test case for it (222) > and even made it safe

Re: [Qemu-block] [Qemu-devel] [PATCH] iotests: 082: Update output

2018-10-31 Thread Fam Zheng
On Wed, 10/31 16:04, Fam Zheng wrote: > Commit 9cbef9d68e (qemu-option: improve qemu_opts_print_help() output) > affected qemu-img help output, and broke this test case. > > Update the output reference to fix it. > > Signed-off-by: Fam Zheng > > --- > > I'm once again looking at enabling

Re: [Qemu-block] [PATCH] blockdev: report error on block latency histogram set error

2018-10-31 Thread Vladimir Sementsov-Ogievskiy
18.10.2018 13:42, zhenwei pi wrote: > Function block_latency_histogram_set may return error, but qapi ignore > this. > This can be reproduced easily by qmp command: > virsh qemu-monitor-command INSTANCE > '{"execute":"x-block-latency-histogram-set", >