The option "queue-size" in virtio-blk was added in qemu-2.12.0, and default value increased from qemu-5.0.0. However, increasing this value may lead to drop of random access performance. To add disk queue_size option, first this commit add interface to accept. Signed-off-by: Hiroki Narukawa <hnarukaw@xxxxxxxxxxxxx> --- docs/formatdomain.rst | 4 +++- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 13 +++++++++++++ src/conf/domain_conf.h | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 479a3acfbb..617a892b38 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2474,7 +2474,7 @@ paravirtualized driver is specified via the ``disk`` element. <target dev='vdc' bus='virtio'/> </disk> <disk type='file' device='disk'> - <driver name='qemu' type='qcow2' queues='4'/> + <driver name='qemu' type='qcow2' queues='4' queue_size='256' /> <source file='/var/lib/libvirt/images/domain.qcow'/> <backingStore type='file'> <format type='qcow2'/> @@ -3085,6 +3085,8 @@ paravirtualized driver is specified via the ``disk`` element. (QEMU 2.1)` - The optional ``queues`` attribute specifies the number of virt queues for virtio-blk. ( :since:`Since 3.9.0` ) + - The optional ``queue_size`` attribute specifies the size of each virt + queue for virtio-blk. ( :since:`Since 7.8.0` ) - For virtio disks, `Virtio-specific options <#elementsVirtio>`__ can also be set. ( :since:`Since 3.5.0` ) - The optional ``metadata_cache`` subelement controls aspects related to the diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 11fa24f398..fdc04f90aa 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2363,6 +2363,11 @@ <ref name="positiveInteger"/> </attribute> </optional> + <optional> + <attribute name="queue_size"> + <ref name="positiveInteger"/> + </attribute> + </optional> <ref name="virtioOptions"/> <optional> <element name="metadata_cache"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6cc1f78ec2..123e9b694a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8930,6 +8930,9 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, if (virXMLPropUInt(cur, "queues", 10, VIR_XML_PROP_NONE, &def->queues) < 0) return -1; + if (virXMLPropUInt(cur, "queue_size", 10, VIR_XML_PROP_NONE, &def->queue_size) < 0) + return -1; + return 0; } @@ -20773,6 +20776,13 @@ virDomainDiskDefCheckABIStability(virDomainDiskDef *src, return false; } + if (src->queue_size != dst->queue_size) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target disk queue size %u does not match source %u"), + dst->queues, src->queues); + return false; + } + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; @@ -23423,6 +23433,9 @@ virDomainDiskDefFormatDriver(virBuffer *buf, if (disk->queues) virBufferAsprintf(&attrBuf, " queues='%u'", disk->queues); + if (disk->queue_size) + virBufferAsprintf(&attrBuf, " queue_size='%u'", disk->queue_size); + virDomainVirtioOptionsFormat(&attrBuf, disk->virtio); if (disk->src->metadataCacheMaxSize > 0) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c7e6df7981..688a842660 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -584,6 +584,7 @@ struct _virDomainDiskDef { virDomainDiskDetectZeroes detect_zeroes; char *domain_name; /* backend domain name */ unsigned int queues; + unsigned int queue_size; virDomainDiskModel model; virDomainVirtioOptions *virtio; -- 2.17.1