[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 18/43] block: Iterate over children in refresh_limits
From: |
Max Reitz |
Subject: |
[PATCH v8 18/43] block: Iterate over children in refresh_limits |
Date: |
Tue, 1 Sep 2020 16:33:59 +0200 |
Instead of looking at just bs->file and bs->backing, we should look at
all children that could end up receiving forwarded requests.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
block/io.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/block/io.c b/block/io.c
index 8d777cd0ec..9a1b5c732c 100644
--- a/block/io.c
+++ b/block/io.c
@@ -135,6 +135,8 @@ static void bdrv_merge_limits(BlockLimits *dst, const
BlockLimits *src)
void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
{
BlockDriver *drv = bs->drv;
+ BdrvChild *c;
+ bool have_limits;
Error *local_err = NULL;
memset(&bs->bl, 0, sizeof(bs->bl));
@@ -149,14 +151,21 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error
**errp)
drv->bdrv_co_preadv_part) ? 1 : 512;
/* Take some limits from the children as a default */
- if (bs->file) {
- bdrv_refresh_limits(bs->file->bs, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
+ have_limits = false;
+ QLIST_FOREACH(c, &bs->children, next) {
+ if (c->role & (BDRV_CHILD_DATA | BDRV_CHILD_FILTERED | BDRV_CHILD_COW))
+ {
+ bdrv_refresh_limits(c->bs, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+ bdrv_merge_limits(&bs->bl, &c->bs->bl);
+ have_limits = true;
}
- bdrv_merge_limits(&bs->bl, &bs->file->bs->bl);
- } else {
+ }
+
+ if (!have_limits) {
bs->bl.min_mem_alignment = 512;
bs->bl.opt_mem_alignment = qemu_real_host_page_size;
@@ -164,15 +173,6 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error
**errp)
bs->bl.max_iov = IOV_MAX;
}
- if (bs->backing) {
- bdrv_refresh_limits(bs->backing->bs, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
- }
- bdrv_merge_limits(&bs->bl, &bs->backing->bs->bl);
- }
-
/* Then let the driver override it */
if (drv->bdrv_refresh_limits) {
drv->bdrv_refresh_limits(bs, errp);
--
2.26.2
- [PATCH v8 08/43] throttle: Support compressed writes, (continued)
- [PATCH v8 08/43] throttle: Support compressed writes, Max Reitz, 2020/09/01
- [PATCH v8 09/43] copy-on-read: Support compressed writes, Max Reitz, 2020/09/01
- [PATCH v8 10/43] block: Use bdrv_filter_(bs|child) where obvious, Max Reitz, 2020/09/01
- [PATCH v8 11/43] block: Use CAFs in block status functions, Max Reitz, 2020/09/01
- [PATCH v8 12/43] stream: Deal with filters, Max Reitz, 2020/09/01
- [PATCH v8 13/43] block: Use CAFs when working with backing chains, Max Reitz, 2020/09/01
- [PATCH v8 14/43] block: Use bdrv_cow_child() in bdrv_co_truncate(), Max Reitz, 2020/09/01
- [PATCH v8 15/43] block: Re-evaluate backing file handling in reopen, Max Reitz, 2020/09/01
- [PATCH v8 17/43] vmdk: Drop vmdk_co_flush(), Max Reitz, 2020/09/01
- [PATCH v8 16/43] block: Flush all children in generic code, Max Reitz, 2020/09/01
- [PATCH v8 18/43] block: Iterate over children in refresh_limits,
Max Reitz <=
- [PATCH v8 19/43] block: Use CAFs in bdrv_refresh_filename(), Max Reitz, 2020/09/01
- [PATCH v8 20/43] block: Use CAF in bdrv_co_rw_vmstate(), Max Reitz, 2020/09/01
- [PATCH v8 21/43] block/snapshot: Fix fallback, Max Reitz, 2020/09/01
- [PATCH v8 24/43] block/null: Implement bdrv_get_allocated_file_size, Max Reitz, 2020/09/01
- [PATCH v8 22/43] block: Use CAFs for debug breakpoints, Max Reitz, 2020/09/01
- [PATCH v8 23/43] block: Improve get_allocated_file_size's default, Max Reitz, 2020/09/01
- [PATCH v8 25/43] blockdev: Use CAF in external_snapshot_prepare(), Max Reitz, 2020/09/01
- [PATCH v8 26/43] block: Report data child for query-blockstats, Max Reitz, 2020/09/01
- [PATCH v8 27/43] block: Use child access functions for QAPI queries, Max Reitz, 2020/09/01
- [PATCH v8 28/43] block-copy: Use CAF to find sync=top base, Max Reitz, 2020/09/01