Skip to contentSkip to conversation

block: Introduce "null" drivers

PATCH Applied Fam Zheng 4 participants 9 messages Sep 11, 2014 – Sep 16, 2014 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

v7 cover block: Introduce "null" drivers

v7: Add Benoît's rev-by line in patch 2.
Improved help text in patch 1. (Benoît)

v6: Don't inherit from BlockdevOptionsFile. (Stefan)
Use .bdrv_co_readv instead of .bdrv_read. (Kevin) Sort items in qapi schema definitions in patch 2 & 3.

Fam Zheng (3):
block: Introduce "null" drivers
qapi: Sort BlockdevDriver enum data list
qapi: Sort items in BlockdevOptions definition

 block/Makefile.objs  |   1 +
 block/null.c         | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++
 qapi/block-core.json |  57 +++++++++++------
 3 files changed, 215 insertions(+), 21 deletions(-)
 create mode 100644 block/null.c
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH v7 1/3 block: Introduce "null" drivers

This is an analogue to Linux null_blk. It can be used for testing or benchmarking block device emulation and general block layer functionalities such as coroutines and throttling, where disk IO is not necessary or wanted.

Use null-aio:// for AIO version, and null-co:// for coroutine version.

---
 block/Makefile.objs  |   1 +
 block/null.c         | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++
 qapi/block-core.json |  19 +++++-
 3 files changed, 196 insertions(+), 2 deletions(-)
 create mode 100644 block/null.c
block/Makefile.objs +1 -0
index f45f939..36a844f 100644
@@ -9,6 +9,7 @@ block-obj-y += snapshot.o qapi.o
 block-obj-$(CONFIG_WIN32) += raw-win32.o win32-aio.o
 block-obj-$(CONFIG_POSIX) += raw-posix.o
 block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
+block-obj-y += null.o
 
 block-obj-y += nbd.o nbd-client.o sheepdog.o
 block-obj-$(CONFIG_LIBISCSI) += iscsi.o
block/null.c new file +178 -0

178 lines not on this page · raw message

qapi/block-core.json +17 -2
index a685d02..bf0cb23 100644
@@ -1150,7 +1150,8 @@
   'data': [ 'archipelago', 'file', 'host_device', 'host_cdrom', 'host_floppy',
             'http', 'https', 'ftp', 'ftps', 'tftp', 'vvfat', 'blkdebug',
             'blkverify', 'bochs', 'cloop', 'cow', 'dmg', 'parallels', 'qcow',
-            'qcow2', 'qed', 'raw', 'vdi', 'vhdx', 'vmdk', 'vpc', 'quorum' ] }
+            'qcow2', 'qed', 'raw', 'vdi', 'vhdx', 'vmdk', 'vpc', 'quorum',
+            'null-aio', 'null-co' ] }
 
 ##
 # @BlockdevOptionsBase
@@ -1203,6 +1204,18 @@
   'data': { 'filename': 'str' } }
 
 ##
+# @BlockdevOptionsNull
+#
+# Driver specific block device options for the null backend.
+#
+# @size:    #optional size of the device in bytes.
+#
+# Since: 2.2
+##
+{ 'type': 'BlockdevOptionsNull',
+  'data': { '*size': 'int' } }
+
+##
 # @BlockdevOptionsVVFAT
 #
 # Driver specific block device options for the vvfat protocol.
@@ -1502,7 +1515,9 @@
       'vhdx':       'BlockdevOptionsGenericFormat',
       'vmdk':       'BlockdevOptionsGenericCOWFormat',
       'vpc':        'BlockdevOptionsGenericFormat',
-      'quorum':     'BlockdevOptionsQuorum'
+      'quorum':     'BlockdevOptionsQuorum',
+      'null-aio':   'BlockdevOptionsNull',
+      'null-co':    'BlockdevOptionsNull'
   } }
 
 ##
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH v7 2/3 qapi: Sort BlockdevDriver enum data list

In reply to Fam Zheng
---
 qapi/block-core.json | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
qapi/block-core.json +5 -5
index bf0cb23..35191b4 100644
@@ -1147,11 +1147,11 @@
 # Since: 2.0
 ##
 { 'enum': 'BlockdevDriver',
-  'data': [ 'archipelago', 'file', 'host_device', 'host_cdrom', 'host_floppy',
-            'http', 'https', 'ftp', 'ftps', 'tftp', 'vvfat', 'blkdebug',
-            'blkverify', 'bochs', 'cloop', 'cow', 'dmg', 'parallels', 'qcow',
-            'qcow2', 'qed', 'raw', 'vdi', 'vhdx', 'vmdk', 'vpc', 'quorum',
-            'null-aio', 'null-co' ] }
+  'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop', 'cow',
+            'dmg', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
+            'host_floppy', 'http', 'https', 'null-aio', 'null-co', 'parallels',
+            'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', 'vdi', 'vhdx',
+            'vmdk', 'vpc', 'vvfat' ] }
 
 ##
 # @BlockdevOptionsBase
Signature · 1 line
1.9.3
author
#3 lore raw

PATCH v7 3/3 qapi: Sort items in BlockdevOptions definition

In reply to Fam Zheng
---
 qapi/block-core.json | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
qapi/block-core.json +19 -19
index 35191b4..5adef27 100644
@@ -1483,41 +1483,41 @@
   'discriminator': 'driver',
   'data': {
       'archipelago':'BlockdevOptionsArchipelago',
+      'blkdebug':   'BlockdevOptionsBlkdebug',
+      'blkverify':  'BlockdevOptionsBlkverify',
+      'bochs':      'BlockdevOptionsGenericFormat',
+      'cloop':      'BlockdevOptionsGenericFormat',
+      'cow':        'BlockdevOptionsGenericCOWFormat',
+      'dmg':        'BlockdevOptionsGenericFormat',
       'file':       'BlockdevOptionsFile',
-      'host_device':'BlockdevOptionsFile',
+      'ftp':        'BlockdevOptionsFile',
+      'ftps':       'BlockdevOptionsFile',
+# TODO gluster: Wait for structured options
       'host_cdrom': 'BlockdevOptionsFile',
+      'host_device':'BlockdevOptionsFile',
       'host_floppy':'BlockdevOptionsFile',
       'http':       'BlockdevOptionsFile',
       'https':      'BlockdevOptionsFile',
-      'ftp':        'BlockdevOptionsFile',
-      'ftps':       'BlockdevOptionsFile',
-      'tftp':       'BlockdevOptionsFile',
-# TODO gluster: Wait for structured options
 # TODO iscsi: Wait for structured options
 # TODO nbd: Should take InetSocketAddress for 'host'?
 # TODO nfs: Wait for structured options
-# TODO rbd: Wait for structured options
-# TODO sheepdog: Wait for structured options
-# TODO ssh: Should take InetSocketAddress for 'host'?
-      'vvfat':      'BlockdevOptionsVVFAT',
-      'blkdebug':   'BlockdevOptionsBlkdebug',
-      'blkverify':  'BlockdevOptionsBlkverify',
-      'bochs':      'BlockdevOptionsGenericFormat',
-      'cloop':      'BlockdevOptionsGenericFormat',
-      'cow':        'BlockdevOptionsGenericCOWFormat',
-      'dmg':        'BlockdevOptionsGenericFormat',
+      'null-aio':   'BlockdevOptionsNull',
+      'null-co':    'BlockdevOptionsNull',
       'parallels':  'BlockdevOptionsGenericFormat',
-      'qcow':       'BlockdevOptionsGenericCOWFormat',
       'qcow2':      'BlockdevOptionsQcow2',
+      'qcow':       'BlockdevOptionsGenericCOWFormat',
       'qed':        'BlockdevOptionsGenericCOWFormat',
+      'quorum':     'BlockdevOptionsQuorum',
       'raw':        'BlockdevOptionsGenericFormat',
+# TODO rbd: Wait for structured options
+# TODO sheepdog: Wait for structured options
+# TODO ssh: Should take InetSocketAddress for 'host'?
+      'tftp':       'BlockdevOptionsFile',
       'vdi':        'BlockdevOptionsGenericFormat',
       'vhdx':       'BlockdevOptionsGenericFormat',
       'vmdk':       'BlockdevOptionsGenericCOWFormat',
       'vpc':        'BlockdevOptionsGenericFormat',
-      'quorum':     'BlockdevOptionsQuorum',
-      'null-aio':   'BlockdevOptionsNull',
-      'null-co':    'BlockdevOptionsNull'
+      'vvfat':      'BlockdevOptionsVVFAT'
   } }
 
 ##
Signature · 1 line
1.9.3
Reviewed-by on the v7 series
#4 lore raw
In reply to Fam Zheng
Quoted 13 lines · Fam Zheng

v7: Add Benoît's rev-by line in patch 2.
Improved help text in patch 1. (Benoît)

v6: Don't inherit from BlockdevOptionsFile. (Stefan)
Use .bdrv_co_readv instead of .bdrv_read. (Kevin) Sort items in qapi schema definitions in patch 2 & 3.

Fam Zheng (3):
block: Introduce "null" drivers
qapi: Sort BlockdevDriver enum data list
qapi: Sort items in BlockdevOptions definition

Quoted 9 lines
 block/Makefile.objs  |   1 +
 block/null.c         | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++
 qapi/block-core.json |  57 +++++++++++------
 3 files changed, 215 insertions(+), 21 deletions(-)
 create mode 100644 block/null.c
Signature · 1 line
1.9.3

I don't think I will be able to break it further.

#5 lore raw
In reply to Fam Zheng
Quoted 8 lines · Fam Zheng

v7: Add Benoît's rev-by line in patch 2.
Improved help text in patch 1. (Benoît)

v6: Don't inherit from BlockdevOptionsFile. (Stefan)
Use .bdrv_co_readv instead of .bdrv_read. (Kevin) Sort items in qapi schema definitions in patch 2 & 3.

Quoted 4 lines

Fam Zheng (3):
block: Introduce "null" drivers
qapi: Sort BlockdevDriver enum data list
qapi: Sort items in BlockdevOptions definition

Series: Reviewed-by: Eric Blake <[email protected]>

Quoted 7 lines
 block/Makefile.objs  |   1 +
 block/null.c         | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++
 qapi/block-core.json |  57 +++++++++++------
 3 files changed, 215 insertions(+), 21 deletions(-)
 create mode 100644 block/null.c
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#6 lore raw
Quoted 9 lines · Eric Blake
Quoted 8 lines · Fam Zheng

v7: Add Benoît's rev-by line in patch 2.
Improved help text in patch 1. (Benoît)

v6: Don't inherit from BlockdevOptionsFile. (Stefan)
Use .bdrv_co_readv instead of .bdrv_read. (Kevin) Sort items in qapi schema definitions in patch 2 & 3.

Quoted 6 lines
Quoted 4 lines

Fam Zheng (3):
block: Introduce "null" drivers
qapi: Sort BlockdevDriver enum data list
qapi: Sort items in BlockdevOptions definition

Series: Reviewed-by: Eric Blake <[email protected]>

In order for Reviewed-by to get picked up by my scripts, it needs to be in the first column. This prevents false positives like quoted commit messages from polluting the Reviewed-by tags.

In the future, please reply to the cover letter with Reviewed-by in the first column. It is not necessary to say "Series:".

Thanks,
Stefan

#7 lore raw
Quoted 15 lines · Stefan Hajnoczi
Quoted 14 lines · Eric Blake
Quoted 12 lines · Fam Zheng

v7: Add Benoît's rev-by line in patch 2.
Improved help text in patch 1. (Benoît)

v6: Don't inherit from BlockdevOptionsFile. (Stefan)
Use .bdrv_co_readv instead of .bdrv_read. (Kevin) Sort items in qapi schema definitions in patch 2 & 3.

Fam Zheng (3):
block: Introduce "null" drivers
qapi: Sort BlockdevDriver enum data list
qapi: Sort items in BlockdevOptions definition

Quoted 8 lines
Quoted 1 line

Series: Reviewed-by: Eric Blake <[email protected]>

In order for Reviewed-by to get picked up by my scripts, it needs to be in the first column. This prevents false positives like quoted commit messages from polluting the Reviewed-by tags.

In the future, please reply to the cover letter with Reviewed-by in the first column. It is not necessary to say "Series:".

Sure, will do.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#8 lore raw
In reply to Fam Zheng
Quoted 13 lines · Fam Zheng

v7: Add Benoît's rev-by line in patch 2.
Improved help text in patch 1. (Benoît)

v6: Don't inherit from BlockdevOptionsFile. (Stefan)
Use .bdrv_co_readv instead of .bdrv_read. (Kevin) Sort items in qapi schema definitions in patch 2 & 3.

Fam Zheng (3):
block: Introduce "null" drivers
qapi: Sort BlockdevDriver enum data list
qapi: Sort items in BlockdevOptions definition

Quoted 10 lines
 block/Makefile.objs  |   1 +
 block/null.c         | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++
 qapi/block-core.json |  57 +++++++++++------
 3 files changed, 215 insertions(+), 21 deletions(-)
 create mode 100644 block/null.c
Signature · 1 line
1.9.3

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan