qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [PATCH v2 2/3] doc: Document generic -blockdev options


From: Kevin Wolf
Subject: [Qemu-block] [PATCH v2 2/3] doc: Document generic -blockdev options
Date: Fri, 23 Sep 2016 18:06:20 +0200

This adds documentation for the -blockdev options that apply to all
nodes independent of the block driver used.

All options that are shared by -blockdev and -drive are now explained in
the section for -blockdev. The documentation of -drive mentions that all
-blockdev options are accepted as well.

Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
 qemu-options.hx | 98 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 69 insertions(+), 29 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 542c483..8766589 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -523,6 +523,43 @@ STEXI
 @findex -blockdev
 
 Define a new block driver node.
+
address@hidden @option
address@hidden Valid options for any block driver node:
+
address@hidden @code
address@hidden driver
+Specifies the block driver to use for the given node.
address@hidden node-name
+This defines the name of the block driver node by which it will be referenced
+later. The name must be unique, i.e. it must not match the name of a different
+block driver node, or (if you use @option{-drive} as well) the ID of a drive.
address@hidden read-only
+Open the node read-only. Guest write attempts will fail.
address@hidden cache.direct
+The host page cache can be avoided with @option{cache.direct=on}. This will
+attempt to do disk IO directly to the guest's memory. QEMU may still perform an
+internal copy of the data.
address@hidden cache.no-flush
+In case you don't care about data integrity over host failures, use
address@hidden This option tells QEMU that it never needs to write
+any data to the disk but can instead keep things in cache. If anything goes
+wrong, like your host losing power, the disk storage getting disconnected
+accidentally, etc. your image will most probably be rendered unusable.
address@hidden address@hidden
address@hidden is one of "ignore" (or "off") or "unmap" (or "on") and controls
+whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap}) requests are
+ignored or passed to the filesystem.  Some machine types may not support
+discard requests.
address@hidden address@hidden
address@hidden is "off", "on" or "unmap" and enables the automatic
+conversion of plain zero writes by the OS to driver specific optimized
+zero write commands. You may even choose "unmap" if @var{discard} is set
+to "unmap" to allow a zero write to be converted to an UNMAP operation.
address@hidden table
+
address@hidden table
+
 ETEXI
 
 DEF("drive", HAS_ARG, QEMU_OPTION_drive,
@@ -544,7 +581,12 @@ STEXI
 @item -drive @var{option}[,@var{option}[,@var{option}[,...]]]
 @findex -drive
 
-Define a new drive. Valid options are:
+Define a new drive. This includes creating a block driver node (the backend) as
+well as a guest device, and is mostly a shortcut for defining the corresponding
address@hidden and @option{-device} options.
+
address@hidden accepts all options that are accepted by @option{-blockdev}. In
+addition, it knows the following options:
 
 @table @option
 @item address@hidden
@@ -571,11 +613,31 @@ These options have the same definition as they have in 
@option{-hdachs}.
 @var{snapshot} is "on" or "off" and controls snapshot mode for the given drive
 (see @option{-snapshot}).
 @item address@hidden
address@hidden is "none", "writeback", "unsafe", "directsync" or "writethrough" 
and controls how the host cache is used to access block data.
address@hidden is "none", "writeback", "unsafe", "directsync" or "writethrough"
+and controls how the host cache is used to access block data. This is a
+shortcut that sets the @option{cache.direct} and @option{cache.no-flush}
+options (as in @option{-blockdev}), and additionally @option{cache.writeback},
+which provides a default for the @option{write-cache} option of block guest
+devices (as in @option{-device}). The modes correspond to the following
+settings:
+
address@hidden Our texi2pod.pl script doesn't support @multitable, so fall back 
to using
address@hidden plain ASCII art (well, UTF-8 art really). This looks okay both 
in the manpage
address@hidden and the HTML output.
address@hidden
+@             │ cache.writeback   cache.direct   cache.no-flush
+─────────────┼─────────────────────────────────────────────────
+writeback    │ on                off            off
+none         │ on                on             off
+writethrough │ off               off            off
+directsync   │ off               on             off
+unsafe       │ on                off            on
address@hidden example
+
+The default mode is @option{cache=writeback}.
+
 @item address@hidden
 @var{aio} is "threads", or "native" and selects between pthread based disk I/O 
and native Linux AIO.
address@hidden address@hidden
address@hidden is one of "ignore" (or "off") or "unmap" (or "on") and controls 
whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap}) requests are 
ignored or passed to the filesystem.  Some machine types may not support 
discard requests.
 @item address@hidden
 Specify which disk @var{format} will be used rather than detecting
 the format.  Can be used to specify format=raw to avoid interpreting
@@ -590,46 +652,24 @@ Specify which @var{action} to take on write and read 
errors. Valid actions are:
 "report" (report the error to the guest), "enospc" (pause QEMU only if the
 host disk is full; report the error to the guest otherwise).
 The default setting is @option{werror=enospc} and @option{rerror=report}.
address@hidden readonly
-Open drive @option{file} as read-only. Guest write attempts will fail.
 @item address@hidden
 @var{copy-on-read} is "on" or "off" and enables whether to copy read backing
 file sectors into the image file.
address@hidden address@hidden
address@hidden is "off", "on" or "unmap" and enables the automatic
-conversion of plain zero writes by the OS to driver specific optimized
-zero write commands. You may even choose "unmap" if @var{discard} is set
-to "unmap" to allow a zero write to be converted to an UNMAP operation.
 @end table
 
-By default, the @option{cache=writeback} mode is used. It will report data
+By default, the @option{cache.writeback=on} mode is used. It will report data
 writes as completed as soon as the data is present in the host page cache.
 This is safe as long as your guest OS makes sure to correctly flush disk caches
 where needed. If your guest OS does not handle volatile disk write caches
 correctly and your host crashes or loses power, then the guest may experience
 data corruption.
 
-For such guests, you should consider using @option{cache=writethrough}. This
+For such guests, you should consider using @option{cache.writeback=off}. This
 means that the host page cache will be used to read and write data, but write
 notification will be sent to the guest only after QEMU has made sure to flush
 each write to the disk. Be aware that this has a major impact on performance.
 
-The host page cache can be avoided entirely with @option{cache=none}.  This 
will
-attempt to do disk IO directly to the guest's memory.  QEMU may still perform
-an internal copy of the data. Note that this is considered a writeback mode and
-the guest OS must handle the disk write cache correctly in order to avoid data
-corruption on host crashes.
-
-The host page cache can be avoided while only sending write notifications to
-the guest when the data has been flushed to the disk using
address@hidden
-
-In case you don't care about data integrity over host failures, use
address@hidden This option tells QEMU that it never needs to write any
-data to the disk but can instead keep things in cache. If anything goes wrong,
-like your host losing power, the disk storage getting disconnected 
accidentally,
-etc. your image will most probably be rendered unusable.   When using
-the @option{-snapshot} option, unsafe caching is always used.
+When using the @option{-snapshot} option, unsafe caching is always used.
 
 Copy-on-read avoids accessing the same backing file sectors repeatedly and is
 useful when the backing file is over a slow network.  By default copy-on-read
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]