]> git.proxmox.com Git - mirror_qemu.git/commit - block/block-backend.c
block-backend: ignore inserted state in blk_co_nb_sectors
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Apr 2023 15:33:02 +0000 (17:33 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 11 Apr 2023 14:40:55 +0000 (16:40 +0200)
commit9ed98cae151368cc89c4bb77c9f325f7185e8f09
tree74319a0ea554ff239fb471c8a7fd5f5f89cdbbc7
parente5203a3b5db1fb1328f104a4863284198b551ce0
block-backend: ignore inserted state in blk_co_nb_sectors

All callers of blk_co_nb_sectors (and blk_nb_sectors) are able to
handle a non-inserted CD-ROM as a zero-length file, they do not need
to raise an error.

Not using blk_co_is_available() aligns the function with
blk_co_get_geometry(), which becomes a simple wrapper for
blk_co_nb_sectors().  It will also make it possible to skip the creation
of a coroutine in the (common) case where bs->bl.has_variable_length
is false.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20230407153303.391121-8-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/block-backend.c