block: cheaper zero handling in backup and commit
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest12 patches 5 repliesIn review
- v39 patches 17 repliesSuperseded
- v29 patches 5 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 9 patches | 9 replies | Superseded |
v3 from the cover letter
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | block/commit: pass BDRV_WANT_PRECISE to block-statusblock/ | +2 | 0 replies | |
| 2/12 | iotests/040: cover large and fragmented commit runstests/ tests/ | +103 | 0 replies | |
| 3/12 | block/commit: batch block-status queriesblock/ | +47 | 0 replies | |
| 4/12 | iotests/124: cover backup of zero clusters and holestests/ tests/ | +348 | 0 replies | |
| 5/12 | block/block-copy: extract block_copy_set_task_method()block/ | +30 | 0 replies | |
| 6/12 | block/block-copy: track known-zero source clustersblock/ block/ include/ | +98 | 0 replies | |
| 7/12 | block/backup: pre-fill zero_bitmap for full/bitmapblock/ block/ include/ | +106 | 0 replies | |
| 8/12 | block/block-copy: rename block_copy_is_cluster_allocated()block/ | +7 | 0 replies | |
| 9/12 | block/block-copy: merge the two backup scan steps into block_copy_prescan()block/ block/ include/ | +27 | 1 reply | |
| 10/12 | block/block-copy: replace zero_bitmap_valid with scan_doneblock/ block/ include/ | +14 | 1 reply | |
| 11/12 | util/co-shared-resource: skip the mutex for an empty requestutil/ | +8 | 1 reply | |
| 12/12 | block/block-copy: coalesce write-zeroes tasksblock/ qapi/ | +88 | 1 reply |
Reviews trailers per patch
11 of 12 patches have a Reviewed-by or Acked-by.
| Patch | Andrey Drobyshev | Vladimir Sementsov-Ogievskiy | Eric Blake |
|---|---|---|---|
| 1/12 | R-b | R-b | R-b |
| 2/12 | R-b | R-b | |
| 3/12 | R-b | R-b | |
| 4/12 | R-b | R-b | |
| 5/12 | R-b | R-b | |
| 6/12 | R-b | ||
| 7/12 | R-b | ||
| 8/12 | |||
| 9/12 | R-b | ||
| 10/12 | R-b | ||
| 11/12 | R-b | ||
| 12/12 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v4 00/12] block: cheaper zero handling in backup and commit
Backup and commit re-query the source block status for every task and size a task by the copy buffer, so a long run of zeroes turns into a crowd of small write-zeroes requests. This series reuses what the up-front scan already learned and lets one write-zeroes task cover a whole run.
Backup of a 16G qcow2 image holding 1G of data, the rest never allocated, sync=full to a raw target on ext4:
tasks time
before 16384 1.6s
after 1088 1.0sSuch an image is the normal case rather than a corner one: a guest with discard enabled on a disk which is mostly free leaves exactly this shape behind.
Eric, this is the v4 you asked about on 10-28; please take it instead of v3.
v4, all from Vladimir's review of v3:
- v3 5/9 "don't reserve memory for zero tasks" is dropped. On its own it let a write-zeroes task bounce through a buffer that s->mem never charged. Its accounting change moves into 12/12 and applies only to a task asking for BDRV_REQ_NO_FALLBACK, the one sure to need no buffer. Its Reviewed-by tags go with it.
- 7/12: each prescan step moves past the dirty area it searched, so a full backup of a fragmented source no longer searches the same range again and again.
- 8/12, 9/12 and 10/12 are new, the follow-ups asked for on v3 7/9:
block_copy_is_cluster_allocated() becomes block_copy_scan_status(), the two prescan helpers merge into block_copy_prescan(), and zero_bitmap_valid becomes scan_done, published together with clearing skip_unallocated.
- 11/12 is new: co_get_from_shres() and co_put_to_shres() skip the mutex for zero bytes, which 12/12 makes the common case.
- 12/12: the serial fallback loop is gone. A refused task shrinks to one cluster and the rest of its range is dirty again, so it comes back as buffer-sized tasks running in parallel instead of one request holding off guest writes to the whole range. A task asking for NO_FALLBACK is left out of s->mem and of speed=. Widening uses bdrv_dirty_bitmap_next_zero(), drops the MAX() with cluster_size, and is no longer bounded by x-perf max-chunk, whose documentation now says so. Andrey's Reviewed-by on v3 is dropped since the patch changed.
- rebased on master
v3:
https://lore.kernel.org/qemu-devel/[email protected]/
Denis V. Lunev (12):
block/commit: pass BDRV_WANT_PRECISE to block-status iotests/040: cover large and fragmented commit runs block/commit: batch block-status queries iotests/124: cover backup of zero clusters and holes block/block-copy: extract block_copy_set_task_method() block/block-copy: track known-zero source clusters block/backup: pre-fill zero_bitmap for full/bitmap block/block-copy: rename block_copy_is_cluster_allocated() block/block-copy: merge the two backup scan steps into
block_copy_prescan()
block/block-copy: replace zero_bitmap_valid with scan_done util/co-shared-resource: skip the mutex for an empty request block/block-copy: coalesce write-zeroes tasks
block/backup.c | 86 ++++---- block/block-copy.c | 326 +++++++++++++++++++++++++------ block/commit.c | 58 ++++-- include/block/block-copy.h | 6 +- qapi/block-core.json | 4 +- tests/qemu-iotests/040 | 102 +++++++++- tests/qemu-iotests/040.out | 4 +- tests/qemu-iotests/124 | 347 ++++++++++++++++++++++++++++++++- tests/qemu-iotests/124.out | 4 +- util/qemu-co-shared-resource.c | 8 + 10 files changed, 829 insertions(+), 116 deletions(-)
base-commit: 73294d096cc591e122fde9e63db4739de6d84f2b
Signature · 1 line
2.53.0