[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] block: refresh bs->total_sectors on reopen
From: |
Paolo Bonzini |
Subject: |
[PATCH 3/8] block: refresh bs->total_sectors on reopen |
Date: |
Fri, 7 Apr 2023 17:32:58 +0200 |
After reopening a BlockDriverState, it's possible that the size of the
underlying file has changed. This for example is covered by test 171.
Right now, this is handled by the raw driver's has_variable_length = true
setting. Since this will be removed by the next patch, handle it on
reopen instead, together with the existing bdrv_refresh_limits.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index b1b7c7efe036..9de50ac7c811 100644
--- a/block.c
+++ b/block.c
@@ -4918,6 +4918,7 @@ static void bdrv_reopen_commit(BDRVReopenState
*reopen_state)
qdict_del(bs->options, "backing");
bdrv_refresh_limits(bs, NULL, NULL);
+ bdrv_refresh_total_sectors(bs, bs->total_sectors);
}
/*
--
2.39.2
- [PATCH 8.0 regression 0/8] block: remove bdrv_co_get_geometry coroutines from I/O hot path, Paolo Bonzini, 2023/04/07
- [PATCH 1/8] block: move has_variable_length to BlockLimits, Paolo Bonzini, 2023/04/07
- [PATCH 2/8] block: remove has_variable_length from filters, Paolo Bonzini, 2023/04/07
- [PATCH 3/8] block: refresh bs->total_sectors on reopen,
Paolo Bonzini <=
- [PATCH 5/8] migration/block: replace uses of blk_nb_sectors that do not check result, Paolo Bonzini, 2023/04/07
- [PATCH 4/8] block: remove has_variable_length from BlockDriver, Paolo Bonzini, 2023/04/07
- [PATCH 6/8] block-backend: inline bdrv_co_get_geometry, Paolo Bonzini, 2023/04/07
- [PATCH 8/8] block, block-backend: write some hot coroutine wrappers by hand, Paolo Bonzini, 2023/04/07