On 05/12/2016 08:35 AM, Kevin Wolf wrote:
> From: Eric Blake <ebl...@redhat.com>
> 
> Make it easier to test block drivers with BDRV_REQ_FUA in
> .supported_write_flags, by adding the '-f' flag to qemu-io to
> conditionally pass the flag through to specific writes ('write',
> 'write -z', 'writev', 'aio_write', 'aio_write -z'). You'll want
> to use 'qemu-io -t none' to actually make -f useful (as
> otherwise, the default writethrough mode automatically sets the
> FUA bit on every write).
> 
> Signed-off-by: Eric Blake <ebl...@redhat.com>
> Message-id: 1462677405-4752-6-git-send-email-ebl...@redhat.com
> Reviewed-by: Max Reitz <mre...@redhat.com>
> Signed-off-by: Max Reitz <mre...@redhat.com>
> ---
>  qemu-io-cmds.c | 57 +++++++++++++++++++++++++++++++++++++++++----------------
>  1 file changed, 41 insertions(+), 16 deletions(-)
> 

> @@ -935,6 +938,7 @@ static void write_help(void)
> +" -f, -- use Force Unit Access semantics\n"

> @@ -951,7 +955,7 @@ static const cmdinfo_t write_cmd = {
> -    .args       = "[-bcCqz] [-P pattern] off len",
> +    .args       = "[-bcCfqz] [-P pattern] off len",

> @@ -969,7 +974,7 @@ static int write_f(BlockBackend *blk, int argc, char 
> **argv)
> -    while ((c = getopt(argc, argv, "bcCpP:qz")) != -1) {
> +    while ((c = getopt(argc, argv, "bcCfpP:qz")) != -1) {

> @@ -980,6 +985,9 @@ static int write_f(BlockBackend *blk, int argc, char 
> **argv)
>          case 'C':
>              Cflag = true;
>              break;
> +        case 'f':

Four places to touch per added option.  'write -f' is okay...

> @@ -1097,6 +1110,7 @@ writev_help(void)
> +" -f, -- use Force Unit Access semantics\n"

> @@ -1108,7 +1122,7 @@ static const cmdinfo_t writev_cmd = {
> -    .args       = "[-Cq] [-P pattern] off len [len..]",
> +    .args       = "[-Cfq] [-P pattern] off len [len..]",

> @@ -1131,6 +1146,9 @@ static int writev_f(BlockBackend *blk, int argc, char 
> **argv)
> +        case 'f':

Whoops - forgot to update getopt() for 'writev -f'. Followup patch
coming shortly.  I also botched it in 65/69, for 'aio_write -z -u'.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to