[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 34/64] block: Iterate over children in refresh_limits
From: |
Kevin Wolf |
Subject: |
[PULL 34/64] block: Iterate over children in refresh_limits |
Date: |
Mon, 7 Sep 2020 13:09:06 +0200 |
From: Max Reitz <mreitz@redhat.com>
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.25.4
- [PULL 27/64] block: Use CAFs in block status functions, (continued)
- [PULL 27/64] block: Use CAFs in block status functions, Kevin Wolf, 2020/09/07
- [PULL 25/64] copy-on-read: Support compressed writes, Kevin Wolf, 2020/09/07
- [PULL 28/64] stream: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 30/64] block: Use bdrv_cow_child() in bdrv_co_truncate(), Kevin Wolf, 2020/09/07
- [PULL 31/64] block: Re-evaluate backing file handling in reopen, Kevin Wolf, 2020/09/07
- [PULL 29/64] block: Use CAFs when working with backing chains, Kevin Wolf, 2020/09/07
- [PULL 38/64] block: Use CAFs for debug breakpoints, Kevin Wolf, 2020/09/07
- [PULL 32/64] block: Flush all children in generic code, Kevin Wolf, 2020/09/07
- [PULL 39/64] block: Improve get_allocated_file_size's default, Kevin Wolf, 2020/09/07
- [PULL 40/64] block/null: Implement bdrv_get_allocated_file_size, Kevin Wolf, 2020/09/07
- [PULL 34/64] block: Iterate over children in refresh_limits,
Kevin Wolf <=
- [PULL 35/64] block: Use CAFs in bdrv_refresh_filename(), Kevin Wolf, 2020/09/07
- [PULL 41/64] blockdev: Use CAF in external_snapshot_prepare(), Kevin Wolf, 2020/09/07
- [PULL 36/64] block: Use CAF in bdrv_co_rw_vmstate(), Kevin Wolf, 2020/09/07
- [PULL 43/64] block: Use child access functions for QAPI queries, Kevin Wolf, 2020/09/07
- [PULL 33/64] vmdk: Drop vmdk_co_flush(), Kevin Wolf, 2020/09/07
- [PULL 45/64] mirror: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 48/64] nbd: Use CAF when looking for dirty bitmap, Kevin Wolf, 2020/09/07
- [PULL 46/64] backup: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 51/64] blockdev: Fix active commit choice, Kevin Wolf, 2020/09/07
- [PULL 47/64] commit: Deal with filters, Kevin Wolf, 2020/09/07