Skip to contentSkip to conversation

Update documentation and help related to the preallocation parameter

PATCH Applied Stefano Garzarella 3 participants 7 messages May 24, 2019 – May 29, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

v2 cover Update documentation and help related to the preallocation parameter

Following Markus' advice, I updated the documentation of preallocation parameter in qapi/block-core.json adding default and allowed values (patch 1). I also updated the help related to BLOCK_OPT_PREALLOC in the QemuOptsList of file-posix (patch 2) and gluster (patch 3).

v2:
- Patch 1: removed references to "file-win32" and "file-posix" in the block comment [Markus]
- Patch 3: reworded commit message [Markus]

Stefano Garzarella (3):
qapi/block-core: update documentation of preallocation parameter block/file-posix: update .help of BLOCK_OPT_PREALLOC option block/gluster: update .help of BLOCK_OPT_PREALLOC option

 qapi/block-core.json | 20 ++++++++++++++------
 block/file-posix.c   |  6 +++++-
 block/gluster.c      |  9 ++++++++-
 3 files changed, 27 insertions(+), 8 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/3 qapi/block-core: update documentation of preallocation parameter

Add default and available values in the documentation block of each block device or protocol that supports the 'preallocation' parameter during the image creation.

---
 qapi/block-core.json | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
qapi/block-core.json +14 -6
index 7ccbfff9d0..e2f7e2b89f 100644
@@ -4103,7 +4103,10 @@
 #
 # @filename         Filename for the new image file
 # @size             Size of the virtual disk in bytes
-# @preallocation    Preallocation mode for the new image (default: off)
+# @preallocation    Preallocation mode for the new image (default: off;
+#                   allowed values: off,
+#                   falloc (if defined CONFIG_POSIX_FALLOCATE),
+#                   full (if defined CONFIG_POSIX))
 # @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
 #
 # Since: 2.12
@@ -4121,7 +4124,10 @@
 #
 # @location         Where to store the new image file
 # @size             Size of the virtual disk in bytes
-# @preallocation    Preallocation mode for the new image (default: off)
+# @preallocation    Preallocation mode for the new image (default: off;
+#                   allowed values: off,
+#                   falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
+#                   full (if defined CONFIG_GLUSTERFS_ZEROFILL))
 #
 # Since: 2.12
 ##
@@ -4225,7 +4231,8 @@
 # @backing-fmt      Name of the block driver to use for the backing file
 # @encrypt          Encryption options if the image should be encrypted
 # @cluster-size     qcow2 cluster size in bytes (default: 65536)
-# @preallocation    Preallocation mode for the new image (default: off)
+# @preallocation    Preallocation mode for the new image (default: off;
+#                   allowed values: off, falloc, full, metadata)
 # @lazy-refcounts   True if refcounts may be updated lazily (default: off)
 # @refcount-bits    Width of reference counts in bits (default: 16)
 #
@@ -4408,7 +4415,8 @@
 # @location         Where to store the new image file
 # @size             Size of the virtual disk in bytes
 # @backing-file     File name of a base image
-# @preallocation    Preallocation mode (allowed values: off, full)
+# @preallocation    Preallocation mode for the new image (default: off;
+#                   allowed values: off, full)
 # @redundancy       Redundancy of the image
 # @object-size      Object size of the image
 #
@@ -4443,8 +4451,8 @@
 #
 # @file             Node to create the image format on
 # @size             Size of the virtual disk in bytes
-# @preallocation    Preallocation mode for the new image (allowed values: off,
-#                   metadata; default: off)
+# @preallocation    Preallocation mode for the new image (default: off;
+#                   allowed values: off, metadata)
 #
 # Since: 2.12
 ##
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/3 block/file-posix: update .help of BLOCK_OPT_PREALLOC option

In reply to Stefano Garzarella

Show 'falloc' among the allowed values of 'preallocation' option, only when it is supported (if defined CONFIG_POSIX_FALLOCATE)

---
 block/file-posix.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
block/file-posix.c +5 -1
index d018429672..9632e3a87b 100644
@@ -2751,7 +2751,11 @@ static QemuOptsList raw_create_opts = {
         {
             .name = BLOCK_OPT_PREALLOC,
             .type = QEMU_OPT_STRING,
-            .help = "Preallocation mode (allowed values: off, falloc, full)"
+            .help = "Preallocation mode (allowed values: off"
+#ifdef CONFIG_POSIX_FALLOCATE
+                    ", falloc"
+#endif
+                    ", full)"
         },
         { /* end of list */ }
     }
Signature · 1 line
2.20.1
#3 lore raw

PATCH v2 3/3 block/gluster: update .help of BLOCK_OPT_PREALLOC option

In reply to Stefano Garzarella

Add missing 'falloc' among the allowed values of 'preallocation' option; show it and 'full' only when they are supported. ('falloc' is supported if defined CONFIG_GLUSTERFS_FALLOCATE, 'full' is supported if defined CONFIG_GLUSTERFS_ZEROFILL)

---
 block/gluster.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
block/gluster.c +8 -1
index e664ca4462..682fe49912 100644
@@ -97,7 +97,14 @@ static QemuOptsList qemu_gluster_create_opts = {
         {
             .name = BLOCK_OPT_PREALLOC,
             .type = QEMU_OPT_STRING,
-            .help = "Preallocation mode (allowed values: off, full)"
+            .help = "Preallocation mode (allowed values: off"
+#ifdef CONFIG_GLUSTERFS_FALLOCATE
+                    ", falloc"
+#endif
+#ifdef CONFIG_GLUSTERFS_ZEROFILL
+                    ", full"
+#endif
+                    ")"
         },
         {
             .name = GLUSTER_OPT_DEBUG,
Signature · 1 line
2.20.1
#5 lore raw
Quoted 2 lines · Markus Armbruster

Kevin, Max, this series looks ready to me. Feel free to ask me to take it through my tree.

*ask*

:-)

#6 lore raw
In reply to Stefano Garzarella
Quoted 4 lines · Stefano Garzarella

Following Markus' advice, I updated the documentation of preallocation parameter in qapi/block-core.json adding default and allowed values (patch 1). I also updated the help related to BLOCK_OPT_PREALLOC in the QemuOptsList of file-posix (patch 2) and gluster (patch 3).

Queued. Thanks!