Richard W.M. Jones
2019-Apr-05 09:52 UTC
[Libguestfs] [PATCH nbdkit] vddk: Add support for VIXDISKLIB_FLAG_OPEN_UNBUFFERED.
I suppose we may as well implement the only other flag too ... It's not clear what this does, something like O_DIRECT I imagine. Rich.
Richard W.M. Jones
2019-Apr-05 09:52 UTC
[Libguestfs] [PATCH nbdkit] vddk: Add support for VIXDISKLIB_FLAG_OPEN_UNBUFFERED.
--- plugins/vddk/nbdkit-vddk-plugin.pod | 6 ++++++ plugins/vddk/vddk-structs.h | 1 + plugins/vddk/vddk.c | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod index 25a6511..49ac4a8 100644 --- a/plugins/vddk/nbdkit-vddk-plugin.pod +++ b/plugins/vddk/nbdkit-vddk-plugin.pod @@ -10,6 +10,7 @@ nbdkit-vddk-plugin - nbdkit VMware VDDK plugin [cookie=COOKIE] [thumbprint=THUMBPRINT] [port=PORT] [nfchostport=PORT] [single-link=true] [snapshot=MOREF] [transports=MODE:MODE:...] + [unbuffered=true] nbdkit vddk --dump-plugin =head1 DESCRIPTION @@ -164,6 +165,11 @@ values include ‘nbd’, ‘nbdssl’, ‘san’, ‘hotadd’, ‘file’ (the others). If not given, VDDK will try to choose the best transport mode. +=item B<unbuffered=true> + +Optional. Disable host caching. This corresponds to the +C<VIXDISKLIB_FLAG_OPEN_UNBUFFERED> flag. + =item B<user=>USERNAME Optional (required for remote connections). The username to connect diff --git a/plugins/vddk/vddk-structs.h b/plugins/vddk/vddk-structs.h index bc68ac6..2469222 100644 --- a/plugins/vddk/vddk-structs.h +++ b/plugins/vddk/vddk-structs.h @@ -43,6 +43,7 @@ typedef uint64_t VixError; #define VIX_OK 0 +#define VIXDISKLIB_FLAG_OPEN_UNBUFFERED 1 #define VIXDISKLIB_FLAG_OPEN_SINGLE_LINK 2 #define VIXDISKLIB_FLAG_OPEN_READ_ONLY 4 #define VIXDISKLIB_SECTOR_SIZE 512 diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c index c3061e9..b9b3d4a 100644 --- a/plugins/vddk/vddk.c +++ b/plugins/vddk/vddk.c @@ -95,6 +95,7 @@ static bool single_link = false; /* single-link */ static const char *snapshot_moref = NULL; /* snapshot */ static const char *thumb_print = NULL; /* thumbprint */ static const char *transport_modes = NULL; /* transports */ +static bool unbuffered = false; /* unbuffered */ static const char *username = NULL; /* user */ static const char *vmx_spec = NULL; /* vm */ static bool is_remote = false; @@ -271,6 +272,13 @@ vddk_config (const char *key, const char *value) else if (strcmp (key, "transports") == 0) { transport_modes = value; } + else if (strcmp (key, "unbuffered") == 0) { + int r = nbdkit_parse_bool (value); + + if (r == -1) + return -1; + unbuffered = r; + } else if (strcmp (key, "user") == 0) { username = value; } @@ -474,6 +482,8 @@ vddk_open (int readonly) flags |= VIXDISKLIB_FLAG_OPEN_READ_ONLY; if (single_link) flags |= VIXDISKLIB_FLAG_OPEN_SINGLE_LINK; + if (unbuffered) + flags |= VIXDISKLIB_FLAG_OPEN_UNBUFFERED; DEBUG_CALL ("VixDiskLib_Open", "connection, %s, %d, &handle", filename, flags); -- 2.20.1
Apparently Analagous Threads
- [PATCH NOT WORKING nbdkit] vddk: Restructure plugin to allow greater parallelism.
- [PATCH nbdkit] vddk: Add support for VIXDISKLIB_FLAG_OPEN_SINGLE_LINK
- [PATCH NOT WORKING nbdkit v2 0/2] vddk: Restructure plugin to allow greater parallelism.
- [nbdkit PATCH 0/3] Fix data integrity in vddk plugin
- [PATCH nbdkit NOT WORKING 0/2] vddk: Relax threading model.