[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/10] block: refresh bs->total_sectors on reopen
From: |
Kevin Wolf |
Subject: |
[PULL 05/10] block: refresh bs->total_sectors on reopen |
Date: |
Tue, 11 Apr 2023 17:01:42 +0200 |
From: Paolo Bonzini <pbonzini@redhat.com>
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>
Message-Id: <20230407153303.391121-4-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block.c b/block.c
index 6a805ff0ea..be7dc5d3e9 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
- [PULL 00/10] Block layer fixes for 8.0-rc4, Kevin Wolf, 2023/04/11
- [PULL 07/10] migration/block: replace uses of blk_nb_sectors that do not check result, Kevin Wolf, 2023/04/11
- [PULL 03/10] block: move has_variable_length to BlockLimits, Kevin Wolf, 2023/04/11
- [PULL 05/10] block: refresh bs->total_sectors on reopen,
Kevin Wolf <=
- [PULL 08/10] block-backend: inline bdrv_co_get_geometry, Kevin Wolf, 2023/04/11
- [PULL 06/10] block: remove has_variable_length from BlockDriver, Kevin Wolf, 2023/04/11
- [PULL 10/10] block, block-backend: write some hot coroutine wrappers by hand, Kevin Wolf, 2023/04/11
- [PULL 09/10] block-backend: ignore inserted state in blk_co_nb_sectors, Kevin Wolf, 2023/04/11
- [PULL 02/10] iotests: Regression test for vhdx log corruption, Kevin Wolf, 2023/04/11
- [PULL 01/10] block/vhdx: fix dynamic VHDX BAT corruption, Kevin Wolf, 2023/04/11
- [PULL 04/10] block: remove has_variable_length from filters, Kevin Wolf, 2023/04/11
- Re: [PULL 00/10] Block layer fixes for 8.0-rc4, Peter Maydell, 2023/04/12