* [PULL v2 0/8] block-job patches 2025-04-29
@ 2025-05-01 9:25 Vladimir Sementsov-Ogievskiy
2025-05-01 9:25 ` [PULL v2 3/8] block: refactor error handling of commit_iteration Vladimir Sementsov-Ogievskiy
2025-05-05 15:22 ` [PULL v2 0/8] block-job patches 2025-04-29 Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2025-05-01 9:25 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, vsementsov, stefanha
The following changes since commit 73d29ea2417b58ca55fba1aa468ba38e3607b583:
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2025-04-27 12:47:23 -0400)
are available in the Git repository at:
https://gitlab.com/vsementsov/qemu.git tags/pull-block-jobs-2025-04-29-v2
for you to fetch changes up to 35655b2d1b1015e3a6fa99ef9c2afc1826a765ba:
blockdev-backup: Add error handling option for copy-before-write jobs (2025-05-01 12:12:19 +0300)
----------------------------------------------------------------
block-job patches
- deprecate some old block-job- APIs
- on-cbw-error option for backup
- more efficient zero handling in block commit
v2:
[03]: move variable declaration to function top, to silence clang and to
follow QEMU coding style
----------------------------------------------------------------
Raman Dzehtsiar (1):
blockdev-backup: Add error handling option for copy-before-write jobs
Vincent Vanlaer (5):
block: get type of block allocation in commit_run
block: move commit_run loop to separate function
block: refactor error handling of commit_iteration
block: allow commit to unmap zero blocks
block: add test non-active commit with zeroed data
Vladimir Sementsov-Ogievskiy (2):
qapi: synchronize jobs and block-jobs documentation
qapi/block-core: deprecate some block-job- APIs
block/backup.c | 3 +-
block/commit.c | 118 +++++++++++++++++-------
block/copy-before-write.c | 2 +
block/copy-before-write.h | 1 +
block/replication.c | 4 +-
blockdev.c | 6 ++
docs/about/deprecated.rst | 31 +++++++
include/block/block_int-global-state.h | 2 +
qapi/block-core.json | 95 ++++++++++++++-----
qapi/job.json | 30 +++++-
tests/qemu-iotests/tests/commit-zero-blocks | 96 +++++++++++++++++++
tests/qemu-iotests/tests/commit-zero-blocks.out | 54 +++++++++++
tests/qemu-iotests/tests/copy-before-write | 90 ++++++++++++++++++
tests/qemu-iotests/tests/copy-before-write.out | 4 +-
14 files changed, 471 insertions(+), 65 deletions(-)
create mode 100755 tests/qemu-iotests/tests/commit-zero-blocks
create mode 100644 tests/qemu-iotests/tests/commit-zero-blocks.out
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PULL v2 3/8] block: refactor error handling of commit_iteration
2025-05-01 9:25 [PULL v2 0/8] block-job patches 2025-04-29 Vladimir Sementsov-Ogievskiy
@ 2025-05-01 9:25 ` Vladimir Sementsov-Ogievskiy
2025-05-05 15:22 ` [PULL v2 0/8] block-job patches 2025-04-29 Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2025-05-01 9:25 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, vsementsov, stefanha, Vincent Vanlaer
From: Vincent Vanlaer <libvirt-e6954efa@volkihar.be>
Signed-off-by: Vincent Vanlaer <libvirt-e6954efa@volkihar.be>
Message-Id: <20241026163010.2865002-4-libvirt-e6954efa@volkihar.be>
[vsementsov]: move action declaration to the top of the function
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
block/commit.c | 63 ++++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 27 deletions(-)
diff --git a/block/commit.c b/block/commit.c
index 3ee0ade7df..5c6596a52e 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -129,51 +129,60 @@ static void commit_clean(Job *job)
}
static int commit_iteration(CommitBlockJob *s, int64_t offset,
- int64_t *n, void *buf)
+ int64_t *requested_bytes, void *buf)
{
+ BlockErrorAction action;
+ int64_t bytes = *requested_bytes;
int ret = 0;
- bool copy;
bool error_in_source = true;
/* Copy if allocated above the base */
WITH_GRAPH_RDLOCK_GUARD() {
ret = bdrv_co_common_block_status_above(blk_bs(s->top),
s->base_overlay, true, true, offset, COMMIT_BUFFER_SIZE,
- n, NULL, NULL, NULL);
+ &bytes, NULL, NULL, NULL);
}
- copy = (ret >= 0 && ret & BDRV_BLOCK_ALLOCATED);
- trace_commit_one_iteration(s, offset, *n, ret);
- if (copy) {
- assert(*n < SIZE_MAX);
+ trace_commit_one_iteration(s, offset, bytes, ret);
- ret = blk_co_pread(s->top, offset, *n, buf, 0);
- if (ret >= 0) {
- ret = blk_co_pwrite(s->base, offset, *n, buf, 0);
- if (ret < 0) {
- error_in_source = false;
- }
- }
- }
if (ret < 0) {
- BlockErrorAction action = block_job_error_action(&s->common,
- s->on_error,
- error_in_source,
- -ret);
- if (action == BLOCK_ERROR_ACTION_REPORT) {
- return ret;
- } else {
- *n = 0;
- return 0;
+ goto fail;
+ }
+
+ if (ret & BDRV_BLOCK_ALLOCATED) {
+ assert(bytes < SIZE_MAX);
+
+ ret = blk_co_pread(s->top, offset, bytes, buf, 0);
+ if (ret < 0) {
+ goto fail;
}
+
+ ret = blk_co_pwrite(s->base, offset, bytes, buf, 0);
+ if (ret < 0) {
+ error_in_source = false;
+ goto fail;
+ }
+
+ block_job_ratelimit_processed_bytes(&s->common, bytes);
}
+
/* Publish progress */
- job_progress_update(&s->common.job, *n);
- if (copy) {
- block_job_ratelimit_processed_bytes(&s->common, *n);
+ job_progress_update(&s->common.job, bytes);
+
+ *requested_bytes = bytes;
+
+ return 0;
+
+fail:
+ action = block_job_error_action(&s->common, s->on_error,
+ error_in_source, -ret);
+ if (action == BLOCK_ERROR_ACTION_REPORT) {
+ return ret;
}
+ *requested_bytes = 0;
+
return 0;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PULL v2 0/8] block-job patches 2025-04-29
2025-05-01 9:25 [PULL v2 0/8] block-job patches 2025-04-29 Vladimir Sementsov-Ogievskiy
2025-05-01 9:25 ` [PULL v2 3/8] block: refactor error handling of commit_iteration Vladimir Sementsov-Ogievskiy
@ 2025-05-05 15:22 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2025-05-05 15:22 UTC (permalink / raw)
To: Vladimir Sementsov-Ogievskiy; +Cc: qemu-block, qemu-devel
On Thu, May 1, 2025 at 5:25 AM Vladimir Sementsov-Ogievskiy
<vsementsov@yandex-team.ru> wrote:
>
> The following changes since commit 73d29ea2417b58ca55fba1aa468ba38e3607b583:
>
> Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2025-04-27 12:47:23 -0400)
>
> are available in the Git repository at:
>
> https://gitlab.com/vsementsov/qemu.git tags/pull-block-jobs-2025-04-29-v2
>
> for you to fetch changes up to 35655b2d1b1015e3a6fa99ef9c2afc1826a765ba:
>
> blockdev-backup: Add error handling option for copy-before-write jobs (2025-05-01 12:12:19 +0300)
>
> ----------------------------------------------------------------
> block-job patches
>
> - deprecate some old block-job- APIs
> - on-cbw-error option for backup
> - more efficient zero handling in block commit
>
> v2:
> [03]: move variable declaration to function top, to silence clang and to
> follow QEMU coding style
>
> ----------------------------------------------------------------
> Raman Dzehtsiar (1):
> blockdev-backup: Add error handling option for copy-before-write jobs
iotests-pylint is failing:
Log file "stdout" content for test "03-tests/iotests-pylint.sh" (FAIL):
************* Module tests.copy-before-write
tests/copy-before-write:151:0: C0301: Line too long (94/79) (line-too-long)
https://gitlab.com/qemu-project/qemu/-/jobs/9931080975#L656
>
> Vincent Vanlaer (5):
> block: get type of block allocation in commit_run
> block: move commit_run loop to separate function
> block: refactor error handling of commit_iteration
> block: allow commit to unmap zero blocks
> block: add test non-active commit with zeroed data
>
> Vladimir Sementsov-Ogievskiy (2):
> qapi: synchronize jobs and block-jobs documentation
> qapi/block-core: deprecate some block-job- APIs
>
> block/backup.c | 3 +-
> block/commit.c | 118 +++++++++++++++++-------
> block/copy-before-write.c | 2 +
> block/copy-before-write.h | 1 +
> block/replication.c | 4 +-
> blockdev.c | 6 ++
> docs/about/deprecated.rst | 31 +++++++
> include/block/block_int-global-state.h | 2 +
> qapi/block-core.json | 95 ++++++++++++++-----
> qapi/job.json | 30 +++++-
> tests/qemu-iotests/tests/commit-zero-blocks | 96 +++++++++++++++++++
> tests/qemu-iotests/tests/commit-zero-blocks.out | 54 +++++++++++
> tests/qemu-iotests/tests/copy-before-write | 90 ++++++++++++++++++
> tests/qemu-iotests/tests/copy-before-write.out | 4 +-
> 14 files changed, 471 insertions(+), 65 deletions(-)
> create mode 100755 tests/qemu-iotests/tests/commit-zero-blocks
> create mode 100644 tests/qemu-iotests/tests/commit-zero-blocks.out
>
> --
> 2.48.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-05 15:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 9:25 [PULL v2 0/8] block-job patches 2025-04-29 Vladimir Sementsov-Ogievskiy
2025-05-01 9:25 ` [PULL v2 3/8] block: refactor error handling of commit_iteration Vladimir Sementsov-Ogievskiy
2025-05-05 15:22 ` [PULL v2 0/8] block-job patches 2025-04-29 Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).