qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] hw/block: Introduce rotational qdev property
@ 2017-05-06 12:43 Aurelien Jarno
  2017-05-06 12:43 ` [Qemu-devel] [PATCH 2/3] scsi-disk: export " Aurelien Jarno
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Aurelien Jarno @ 2017-05-06 12:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Paolo Bonzini, John Snow, Max Reitz,
	Kevin Wolf, qemu-block, Aurelien Jarno

The Linux kernel uses different I/O scheduler depending if the block
device is a rotational device or not. Also it uses rotational devices
to add entropy to the random pool.

This patch add a rotational qdev property so that the block device can
be configured as a rotational device or a non-rotational device. Default
to true to not change the default behavior.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 blockdev.c               | 4 ++++
 include/hw/block/block.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/blockdev.c b/blockdev.c
index 4d8cdedd54..c914420641 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4037,6 +4037,10 @@ QemuOptsList qemu_common_drive_opts = {
             .name = BDRV_OPT_READ_ONLY,
             .type = QEMU_OPT_BOOL,
             .help = "open drive file as read-only",
+        },{
+            .name = "rotational",
+            .type = QEMU_OPT_BOOL,
+            .help = "rotational drive (off, on)",
         },
 
         THROTTLE_OPTS,
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
index f3f6e8ef02..304a579eca 100644
--- a/include/hw/block/block.h
+++ b/include/hw/block/block.h
@@ -27,6 +27,7 @@ typedef struct BlockConf {
     uint32_t cyls, heads, secs;
     OnOffAuto wce;
     bool share_rw;
+    bool rotational;
     BlockdevOnError rerror;
     BlockdevOnError werror;
 } BlockConf;
@@ -56,7 +57,8 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
                        _conf.discard_granularity, -1), \
     DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \
                             ON_OFF_AUTO_AUTO), \
-    DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false)
+    DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false), \
+    DEFINE_PROP_BOOL("rotational", _state, _conf.rotational, true)
 
 #define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf)      \
     DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0),  \
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-05-09 10:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-06 12:43 [Qemu-devel] [PATCH 1/3] hw/block: Introduce rotational qdev property Aurelien Jarno
2017-05-06 12:43 ` [Qemu-devel] [PATCH 2/3] scsi-disk: export " Aurelien Jarno
2017-05-06 16:11   ` Philippe Mathieu-Daudé
2017-05-06 12:43 ` [Qemu-devel] [PATCH 3/3] ide: " Aurelien Jarno
2017-05-06 16:11   ` Philippe Mathieu-Daudé
2017-05-08 14:50   ` John Snow
2017-05-06 16:11 ` [Qemu-devel] [PATCH 1/3] hw/block: Introduce " Philippe Mathieu-Daudé
2017-05-06 17:11 ` Eric Blake
2017-05-08 17:22 ` Stefan Hajnoczi
2017-05-09 10:12 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).