qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH 09/22] nbd: Add writethrough to block-export-add


From: Eric Blake
Subject: Re: [RFC PATCH 09/22] nbd: Add writethrough to block-export-add
Date: Wed, 19 Aug 2020 15:13:28 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 8/13/20 11:29 AM, Kevin Wolf wrote:
qemu-nbd allows use of writethrough cache modes, which mean that write
requests made through NBD will cause a flush before they complete.
Expose the same functionality in block-export-add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
  qapi/block-export.json | 7 ++++++-
  blockdev-nbd.c         | 2 +-
  2 files changed, 7 insertions(+), 2 deletions(-)


+++ b/blockdev-nbd.c
@@ -218,7 +218,7 @@ BlockExport *nbd_export_create(BlockExportOptions 
*exp_args, Error **errp)
exp = nbd_export_new(bs, arg->name, arg->description, arg->bitmap,
                           !arg->writable, !arg->writable,
-                         NULL, false, errp);
+                         NULL, exp_args->writethrough, errp);

It would someday be nice to get rid of exp_args->has_writethrough in QAPI generated code, but that's independent of this series. Meanwhile, you are safe in relying on writethrough being false when has_writethrough is false.

This change makes sense to me interface-wise. QAPI-wise, should we try harder to make writethrough settable only for writable exports (and an error for read-only exports)? I'm not sure what QAPI contortions would have to look like to make that enforced by the QMP parser; but it's also not the end of the world if we just always permit the optional field and then apply a post-parse semantic check.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

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