Skip to contentSkip to conversation

block/blkio: Set BlockDriver::has_variable_length to false

PATCH Applied Alberto Faria 3 participants 4 messages Nov 8, 2022 – Nov 11, 2022 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/blkio: Set BlockDriver::has_variable_length to false

Setting it to true can cause the device size to be queried from libblkio in otherwise fast paths, degrading performance. Set it to false and require users to refresh the device size explicitly instead.

Fixes 4c8f4fda0504 ("block/blkio: Tolerate device size changes")
---
 block/blkio.c | 1 -
 1 file changed, 1 deletion(-)
block/blkio.c +0 -1
index 620fab28a7..5eae3adfaf 100644
@@ -993,7 +993,6 @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp)
     { \
         .format_name             = name, \
         .protocol_name           = name, \
-        .has_variable_length     = true, \
         .instance_size           = sizeof(BDRVBlkioState), \
         .bdrv_file_open          = blkio_file_open, \
         .bdrv_close              = blkio_close, \
Signature · 1 line
2.38.1
Applied
#1 lore raw

Am 08.11.2022 um 15:44 hat Alberto Faria geschrieben:

Quoted 7 lines

Setting it to true can cause the device size to be queried from libblkio in otherwise fast paths, degrading performance. Set it to false and require users to refresh the device size explicitly instead.

Fixes 4c8f4fda0504 ("block/blkio: Tolerate device size changes")

Thanks, applied to the block branch.

Kevin

#2 lore raw
In reply to Alberto Faria
Quoted 8 lines · Alberto Faria

Setting it to true can cause the device size to be queried from libblkio in otherwise fast paths, degrading performance. Set it to false and require users to refresh the device size explicitly instead.

Fixes 4c8f4fda0504 ("block/blkio: Tolerate device size changes")

If it's okay to set it to false then that makes me wonder why this undocumented field exists at all. Can you or Kevin explain and possibly follow up with a patch that documents the field?

Thanks,
Stefan

#3 lore raw

Am 10.11.2022 um 22:01 hat Stefan Hajnoczi geschrieben:

Quoted 6 lines · Alberto Faria
Quoted 5 lines

Setting it to true can cause the device size to be queried from libblkio in otherwise fast paths, degrading performance. Set it to false and require users to refresh the device size explicitly instead.

Quoted 7 lines
Quoted 3 lines
Fixes 4c8f4fda0504 ("block/blkio: Tolerate device size changes")

If it's okay to set it to false then that makes me wonder why this undocumented field exists at all. Can you or Kevin explain and possibly follow up with a patch that documents the field?

It is for removable media backends (only host_cdrom has survived until today; there used to be host_floppy, too) where the disk size can change without an explicit block_resize when you change the medium.

I'm not sure how well this works in practice, but so far we've not intentionally broken anything related to it that wasn't always broken.

Kevin