mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
Pull request
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmDm+YkACgkQnKSrs4Gr c8jkfQf+PuiSrU9t5MjU//jKPBpx/Jl9FqsKIlWC+6NOYQFhzD7A7rftuOSG1HOW Cil9rWO/57u/i7DcrABRlMkZ17zv6tP0876LRXRybVnjX4pQ4ayEtMio4WdjAna+ 1hL9P+c6tuo6wlGkM+R2yX4QIOSw+74Qbkh8sLrVwGYzA94erXbuJi/iix8t11iR joiNZ/k6yZPyMbzgT11A0On5qdaNNVfQeA59pyQEnucia02285VkCPLMaO+Trkgl 7VQ1V3cNAdWVaPU0kXDCx595K1BlfrGHNimxfq2UeUZd2AvqHCohlG/egrEHfOu2 Ek4dAqXn6p2eufGi/BzQi8V4J0nPRA== =SDmL -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging Pull request # gpg: Signature made Thu 08 Jul 2021 14:11:37 BST # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha-gitlab/tags/block-pull-request: block/io: Merge discard request alignments block: Add backend_defaults property block/file-posix: Optimize for macOS util/async: print leaked BH name when AioContext finalizes util/async: add a human-readable name to BHs for debugging Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
53c0123118
10 changed files with 163 additions and 19 deletions
|
@ -65,24 +65,58 @@ bool blkconf_blocksizes(BlockConf *conf, Error **errp)
|
|||
{
|
||||
BlockBackend *blk = conf->blk;
|
||||
BlockSizes blocksizes;
|
||||
int backend_ret;
|
||||
BlockDriverState *bs;
|
||||
bool use_blocksizes;
|
||||
bool use_bs;
|
||||
|
||||
switch (conf->backend_defaults) {
|
||||
case ON_OFF_AUTO_AUTO:
|
||||
use_blocksizes = !blk_probe_blocksizes(blk, &blocksizes);
|
||||
use_bs = false;
|
||||
break;
|
||||
|
||||
case ON_OFF_AUTO_ON:
|
||||
use_blocksizes = !blk_probe_blocksizes(blk, &blocksizes);
|
||||
bs = blk_bs(blk);
|
||||
use_bs = bs;
|
||||
break;
|
||||
|
||||
case ON_OFF_AUTO_OFF:
|
||||
use_blocksizes = false;
|
||||
use_bs = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
backend_ret = blk_probe_blocksizes(blk, &blocksizes);
|
||||
/* fill in detected values if they are not defined via qemu command line */
|
||||
if (!conf->physical_block_size) {
|
||||
if (!backend_ret) {
|
||||
if (use_blocksizes) {
|
||||
conf->physical_block_size = blocksizes.phys;
|
||||
} else {
|
||||
conf->physical_block_size = BDRV_SECTOR_SIZE;
|
||||
}
|
||||
}
|
||||
if (!conf->logical_block_size) {
|
||||
if (!backend_ret) {
|
||||
if (use_blocksizes) {
|
||||
conf->logical_block_size = blocksizes.log;
|
||||
} else {
|
||||
conf->logical_block_size = BDRV_SECTOR_SIZE;
|
||||
}
|
||||
}
|
||||
if (use_bs) {
|
||||
if (!conf->opt_io_size) {
|
||||
conf->opt_io_size = bs->bl.opt_transfer;
|
||||
}
|
||||
if (conf->discard_granularity == -1) {
|
||||
if (bs->bl.pdiscard_alignment) {
|
||||
conf->discard_granularity = bs->bl.pdiscard_alignment;
|
||||
} else if (bs->bl.request_alignment != 1) {
|
||||
conf->discard_granularity = bs->bl.request_alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (conf->logical_block_size > conf->physical_block_size) {
|
||||
error_setg(errp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue