]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: add queue_size option to disk
authorHiroki Narukawa <hnarukaw@yahoo-corp.jp>
Thu, 9 Sep 2021 03:34:46 +0000 (12:34 +0900)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Sep 2021 10:22:48 +0000 (12:22 +0200)
The option "queue-size" for 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.

Signed-off-by: Hiroki Narukawa <hnarukaw@yahoo-corp.jp>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
docs/formatdomain.rst
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h

index 9173d9f1d6a2732d2525bc37210d220d2be6787c..0f5d833521d55db3997d2ddcc385f63278bb3550 100644 (file)
@@ -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
index 11fa24f398b1f4e9586b72f3660cffd8d7083c71..fdc04f90aa2aebe34068461571b6f95e41bfb670 100644 (file)
           <ref name="positiveInteger"/>
         </attribute>
       </optional>
+      <optional>
+        <attribute name="queue_size">
+          <ref name="positiveInteger"/>
+        </attribute>
+      </optional>
       <ref name="virtioOptions"/>
       <optional>
         <element name="metadata_cache">
index 47127683d474e979e90ff892a8d10da8fa7c495d..62b9720d0a1a4d976ee21d6a1178d26e6e05509c 100644 (file)
@@ -8931,6 +8931,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;
 }
 
@@ -20774,6 +20777,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;
 
@@ -23424,6 +23434,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) {
index c7e6df7981368b172940d08a32b9d609f9e703ff..688a8426607f68e2003570bca6116a60d89e1604 100644 (file)
@@ -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;