[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/37] nbd: Add writethrough to block-export-add
From: |
Kevin Wolf |
Subject: |
[PULL 13/37] nbd: Add writethrough to block-export-add |
Date: |
Fri, 2 Oct 2020 16:43:21 +0200 |
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>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200924152717.287415-10-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qapi/block-export.json | 7 ++++++-
blockdev-nbd.c | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/qapi/block-export.json b/qapi/block-export.json
index 8aa8a01fa6..ce66f278b2 100644
--- a/qapi/block-export.json
+++ b/qapi/block-export.json
@@ -170,10 +170,15 @@
# Describes a block export, i.e. how single node should be exported on an
# external interface.
#
+# @writethrough: If true, caches are flushed after every write request to the
+# export before completion is signalled. (since: 5.2;
+# default: false)
+#
# Since: 4.2
##
{ 'union': 'BlockExportOptions',
- 'base': { 'type': 'BlockExportType' },
+ 'base': { 'type': 'BlockExportType',
+ '*writethrough': 'bool' },
'discriminator': 'type',
'data': {
'nbd': 'BlockExportOptionsNbd'
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 41d5542987..09247a8ded 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -216,9 +216,13 @@ BlockExport *nbd_export_create(BlockExportOptions
*exp_args, Error **errp)
goto out;
}
+ if (!exp_args->has_writethrough) {
+ exp_args->writethrough = false;
+ }
+
exp = nbd_export_new(bs, arg->name, arg->description, arg->bitmap,
!arg->writable, !arg->writable,
- NULL, false, errp);
+ NULL, exp_args->writethrough, errp);
if (!exp) {
goto out;
}
--
2.25.4
- [PULL 03/37] docs: Document the throttle block filter, (continued)
- [PULL 03/37] docs: Document the throttle block filter, Kevin Wolf, 2020/10/02
- [PULL 06/37] qapi: Create block-export module, Kevin Wolf, 2020/10/02
- [PULL 05/37] nbd: Remove unused nbd_export_get_blockdev(), Kevin Wolf, 2020/10/02
- [PULL 07/37] qapi: Rename BlockExport to BlockExportOptions, Kevin Wolf, 2020/10/02
- [PULL 10/37] qemu-nbd: Use raw block driver for --offset, Kevin Wolf, 2020/10/02
- [PULL 04/37] qemu-io-cmds: Simplify help_oneline, Kevin Wolf, 2020/10/02
- [PULL 11/37] block/export: Remove magic from block-export-add, Kevin Wolf, 2020/10/02
- [PULL 09/37] qemu-storage-daemon: Use qmp_block_export_add(), Kevin Wolf, 2020/10/02
- [PULL 08/37] block/export: Add BlockExport infrastructure and block-export-add, Kevin Wolf, 2020/10/02
- [PULL 12/37] nbd: Add max-connections to nbd-server-start, Kevin Wolf, 2020/10/02
- [PULL 13/37] nbd: Add writethrough to block-export-add,
Kevin Wolf <=
- [PULL 14/37] nbd: Remove NBDExport.close callback, Kevin Wolf, 2020/10/02
- [PULL 16/37] nbd/server: Simplify export shutdown, Kevin Wolf, 2020/10/02
- [PULL 17/37] block/export: Move refcount from NBDExport to BlockExport, Kevin Wolf, 2020/10/02
- [PULL 15/37] qemu-nbd: Use blk_exp_add() to create the export, Kevin Wolf, 2020/10/02
- [PULL 19/37] block/export: Add node-name to BlockExportOptions, Kevin Wolf, 2020/10/02
- [PULL 18/37] block/export: Move AioContext from NBDExport to BlockExport, Kevin Wolf, 2020/10/02
- [PULL 20/37] block/export: Allocate BlockExport in blk_exp_add(), Kevin Wolf, 2020/10/02
- [PULL 21/37] block/export: Add blk_exp_close_all(_type), Kevin Wolf, 2020/10/02
- [PULL 22/37] block/export: Add 'id' option to block-export-add, Kevin Wolf, 2020/10/02
- [PULL 25/37] block/export: Add BLOCK_EXPORT_DELETED event, Kevin Wolf, 2020/10/02