Displaying 20 results from an estimated 37 matches for "nbdkit_cache_none".
2019 May 16
0
[nbdkit PATCH v2 07/24] sh: Implement .cache script callback
...an_cache", h, NULL };
+ CLEANUP_FREE char *s = NULL;
+ size_t slen;
+ int r;
+
+ switch (call_read (&s, &slen, args)) {
+ case OK:
+ if (slen > 0 && s[slen-1] == '\n')
+ s[slen-1] = '\0';
+ if (strcasecmp (s, "none") == 0)
+ r = NBDKIT_CACHE_NONE;
+ else if (strcasecmp (s, "emulate") == 0)
+ r = NBDKIT_CACHE_EMULATE;
+ else if (strcasecmp (s, "native") == 0)
+ r = NBDKIT_CACHE_NATIVE;
+ else {
+ nbdkit_error ("%s: could not parse output from can_cache method: %s",
+ sc...
2019 Nov 22
2
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...tConstant (m, "FUA_NONE", NBDKIT_FUA_NONE);
> + PyModule_AddIntConstant (m, "FUA_EMULATE", NBDKIT_FUA_EMULATE);
> + PyModule_AddIntConstant (m, "FUA_NATIVE", NBDKIT_FUA_NATIVE);
> +
> + PyModule_AddIntConstant (m, "CACHE_NONE", NBDKIT_CACHE_NONE);
> + PyModule_AddIntConstant (m, "CACHE_EMULATE", NBDKIT_CACHE_EMULATE);
> + PyModule_AddIntConstant (m, "CACHE_NATIVE", NBDKIT_CACHE_NATIVE);
> +
> + PyModule_AddIntConstant (m, "EXTENT_HOLE", NBDKIT_EXTENT_HOLE);
> + PyModule_AddIntConstant...
2019 Nov 22
1
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...NBDKIT_FUA_NONE);
> > > + PyModule_AddIntConstant (m, "FUA_EMULATE", NBDKIT_FUA_EMULATE);
> > > + PyModule_AddIntConstant (m, "FUA_NATIVE", NBDKIT_FUA_NATIVE);
> > > +
> > > + PyModule_AddIntConstant (m, "CACHE_NONE", NBDKIT_CACHE_NONE);
> > > + PyModule_AddIntConstant (m, "CACHE_EMULATE", NBDKIT_CACHE_EMULATE);
> > > + PyModule_AddIntConstant (m, "CACHE_NATIVE", NBDKIT_CACHE_NATIVE);
> > > +
> > > + PyModule_AddIntConstant (m, "EXTENT_HOLE", NBDKIT_EXTENT...
2019 May 16
27
[nbdkit PATCH v2 00/24] implement NBD_CMD_CACHE
Since v1:
- rework .can_cache to be tri-state, with default of no advertisement
(ripple effect through other patches)
- add a lot more patches in order to round out filter support
And in the meantime, Rich pushed NBD_CMD_CACHE support into libnbd, so
in theory we now have a way to test cache commands through the entire
stack.
Eric Blake (24):
server: Internal hooks for implementing
2019 Oct 04
1
Re: [nbdkit PATCH 2/5] retry: Check size before transactions
...*err = EIO;
> r = -1;
> @@ -390,6 +411,8 @@ retry_cache (struct nbdkit_next_ops *next_ops, void *nxdata,
> int r;
>
> again:
> + if (! valid_range (next_ops, nxdata, count, offset, false, err))
> + return -1;
> if (next_ops->can_cache (nxdata) <= NBDKIT_CACHE_NONE) {
> *err = EIO;
> r = -1;
> --
> 2.21.0
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs@redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat http://people....
2019 Oct 04
0
[nbdkit PATCH 2/5] retry: Check size before transactions
...xt_ops->can_extents (nxdata) != 1) {
*err = EIO;
r = -1;
@@ -390,6 +411,8 @@ retry_cache (struct nbdkit_next_ops *next_ops, void *nxdata,
int r;
again:
+ if (! valid_range (next_ops, nxdata, count, offset, false, err))
+ return -1;
if (next_ops->can_cache (nxdata) <= NBDKIT_CACHE_NONE) {
*err = EIO;
r = -1;
--
2.21.0
2019 Nov 22
0
[PATCH nbdkit v2 02/10] python: Add various constants to the API.
...+
+ PyModule_AddIntConstant (m, "FUA_NONE", NBDKIT_FUA_NONE);
+ PyModule_AddIntConstant (m, "FUA_EMULATE", NBDKIT_FUA_EMULATE);
+ PyModule_AddIntConstant (m, "FUA_NATIVE", NBDKIT_FUA_NATIVE);
+
+ PyModule_AddIntConstant (m, "CACHE_NONE", NBDKIT_CACHE_NONE);
+ PyModule_AddIntConstant (m, "CACHE_EMULATE", NBDKIT_CACHE_EMULATE);
+ PyModule_AddIntConstant (m, "CACHE_NATIVE", NBDKIT_CACHE_NATIVE);
+
+ PyModule_AddIntConstant (m, "EXTENT_HOLE", NBDKIT_EXTENT_HOLE);
+ PyModule_AddIntConstant (m, "EXTENT_ZERO&quo...
2019 Nov 22
0
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...FUA_NONE", NBDKIT_FUA_NONE);
> > + PyModule_AddIntConstant (m, "FUA_EMULATE", NBDKIT_FUA_EMULATE);
> > + PyModule_AddIntConstant (m, "FUA_NATIVE", NBDKIT_FUA_NATIVE);
> > +
> > + PyModule_AddIntConstant (m, "CACHE_NONE", NBDKIT_CACHE_NONE);
> > + PyModule_AddIntConstant (m, "CACHE_EMULATE", NBDKIT_CACHE_EMULATE);
> > + PyModule_AddIntConstant (m, "CACHE_NATIVE", NBDKIT_CACHE_NATIVE);
> > +
> > + PyModule_AddIntConstant (m, "EXTENT_HOLE", NBDKIT_EXTENT_HOLE);
> > +...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...ill be garbage collected.
> # return nbdkit.CACHE_NONE or nbdkit.CACHE_EMULATE
> # or nbdkit.CACHE_NATIVE
We expose various constants through 'import nbdkit', so...
> +++ b/plugins/python/python.c
> @@ -1020,6 +1020,79 @@ py_can_cache (void *handle)
> return NBDKIT_CACHE_NONE;
> }
>
> +static int
> +py_can_extents (void *handle)
> +{
> + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE;
> + return boolean_callback (handle, "can_extents", "extents");
> +}
> +
> +static int
> +py_extents (void *handle, uint32_t count, uint64...
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...-C<extents>.
+C<magic_config_key>.
These are not yet supported.
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 398473f5..585cd9e6 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -1020,6 +1020,79 @@ py_can_cache (void *handle)
return NBDKIT_CACHE_NONE;
}
+static int
+py_can_extents (void *handle)
+{
+ ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE;
+ return boolean_callback (handle, "can_extents", "extents");
+}
+
+static int
+py_extents (void *handle, uint32_t count, uint64_t offset,
+ uint32_t flags, struct nbdkit_ext...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...y>.
>
> These are not yet supported.
>
> diff --git a/plugins/python/python.c b/plugins/python/python.c
> index 398473f5..585cd9e6 100644
> --- a/plugins/python/python.c
> +++ b/plugins/python/python.c
> @@ -1020,6 +1020,79 @@ py_can_cache (void *handle)
> return NBDKIT_CACHE_NONE;
> }
>
> +static int
> +py_can_extents (void *handle)
> +{
> + ACQUIRE_PYTHON_GIL_FOR_CURRENT_SCOPE;
> + return boolean_callback (handle, "can_extents", "extents");
> +}
> +
> +static int
> +py_extents (void *handle, uint32_t count, uint64_t o...
2019 Aug 30
0
[nbdkit PATCH 9/9] server: Move command validation from protocol.c to backend.c
...tion *conn,
debug ("%s: cache count=%" PRIu32 " offset=%" PRIu64,
b->name, count, offset);
+ if (invalid_range (b, conn, "cache", offset, count)) {
+ *err = EINVAL;
+ return -1;
+ }
assert (h->can_cache >= 0);
if (h->can_cache == NBDKIT_CACHE_NONE) {
nbdkit_error ("invalid request: cache operation not supported");
diff --git a/server/protocol.c b/server/protocol.c
index 03862f5f..db40cca3 100644
--- a/server/protocol.c
+++ b/server/protocol.c
@@ -47,50 +47,43 @@
#include "minmax.h"
#include "protocol.h"...
2019 Oct 07
6
[nbdkit PATCH 0/5] More retry fixes
I think this is my last round of patches for issues I identified with
the retry filter. With this in place, it should be safe to interject
another filter in between retry and the plugin.
Eric Blake (5):
retry: Don't call into closed plugin
tests: Refactor test-retry-reopen-fail.sh
tests: Enhance retry test to cover failed reopen
server: Move prepare/finalize/close recursion to
2019 Oct 04
6
[nbdkit PATCH 0/5] Another round of retry fixes
I still don't have .prepare/.finalize working cleanly across reopen,
but did find a nasty bug where a botched assertion means we failed to
notice reads beyond EOF in both the xz and retry filter.
Refactoring backend.c will make .finalize work easier.
Eric Blake (5):
xz: Avoid reading beyond EOF
retry: Check size before transactions
tests: Test retry when get_size values change
2019 May 16
0
[nbdkit PATCH v2 24/24] nocache: Implement new filter
...Either 'none' (default), 'emulate', or 'nop'.\n" \
+
+/* Advertise desired FLAG_SEND_CACHE mode. */
+static int
+nocache_can_cache (struct nbdkit_next_ops *next_ops, void *nxdata,
+ void *handle)
+{
+ switch (cachemode) {
+ case NONE:
+ return NBDKIT_CACHE_NONE;
+ case EMULATE:
+ return NBDKIT_CACHE_EMULATE;
+ case NOP:
+ return NBDKIT_CACHE_NATIVE;
+ }
+ abort ();
+}
+
+static int
+nocache_cache (struct nbdkit_next_ops *next_ops, void *nxdata,
+ void *handle, uint32_t count, uint64_t offs, uint32_t flags,
+ int *err)...
2020 Aug 07
0
[nbdkit PATCH 3/3] tlsdummy: New filter
...*next_ops, void *nxdata,
+ void *handle)
+{
+ if (NOT_TLS)
+ return 0;
+ return next_ops->can_multi_conn (nxdata);
+}
+
+static int
+tlsdummy_can_cache (struct nbdkit_next_ops *next_ops, void *nxdata,
+ void *handle)
+{
+ if (NOT_TLS)
+ return NBDKIT_CACHE_NONE;
+ return next_ops->can_cache (nxdata);
+}
+
+static int
+tlsdummy_pread (struct nbdkit_next_ops *next_ops, void *nxdata,
+ void *handle, void *b, uint32_t count, uint64_t offs,
+ uint32_t flags, int *err)
+{
+ if (NOT_TLS) {
+ memcpy (b, message + offs, count)...
2019 May 30
0
[nbdkit PATCH 3/4] nbd: Use libnbd 0.1
...to check multi-conn flag: %s", nbd_get_error ());
+ return -1;
+ }
+ return i;
}
static int
nbdplug_can_cache (void *handle)
{
struct handle *h = handle;
+ int i = nbd_can_cache (h->nbd);
- if (h->flags & NBD_FLAG_SEND_CACHE)
- return NBDKIT_CACHE_NATIVE;
- return NBDKIT_CACHE_NONE;
+ if (i == -1) {
+ nbdkit_error ("failure to check cache flag: %s", nbd_get_error ());
+ return -1;
+ }
+ return i ? NBDKIT_CACHE_NATIVE : NBDKIT_CACHE_NONE;
}
static int
nbdplug_can_extents (void *handle)
{
struct handle *h = handle;
+ int i = nbd_can_meta_context (h-&...
2019 Jun 12
0
[nbdkit PATCH v3 3/5] nbd: Use libnbd 0.1.3+
...to check multi-conn flag: %s", nbd_get_error ());
+ return -1;
+ }
+ return i;
}
static int
nbdplug_can_cache (void *handle)
{
struct handle *h = handle;
+ int i = nbd_can_cache (h->nbd);
- if (h->flags & NBD_FLAG_SEND_CACHE)
- return NBDKIT_CACHE_NATIVE;
- return NBDKIT_CACHE_NONE;
+ if (i == -1) {
+ nbdkit_error ("failure to check cache flag: %s", nbd_get_error ());
+ return -1;
+ }
+ return i ? NBDKIT_CACHE_NATIVE : NBDKIT_CACHE_NONE;
}
static int
nbdplug_can_extents (void *handle)
{
struct handle *h = handle;
+ int i = nbd_can_meta_context (h-&...
2019 Nov 22
18
[PATCH nbdkit v2 00/10] Implement nbdkit API v2 for Python plugins.
v1:
https://www.redhat.com/archives/libguestfs/2019-November/msg00153.html
v2:
- Fix implementation of can_cache.
- Add implementation of can_fua.
- Add a very thorough test suite which tests every command + flag
combination.
2019 Aug 30
0
[nbdkit PATCH 6/9] server: Cache per-connection can_FOO flags
...struct nbdkit_next_ops *next_ops, void *nxdata,
uint64_t blknum, blkoffs;
int r;
uint64_t remaining = count; /* Rounding out could exceed 32 bits */
- enum cache_mode mode; /* XXX Cache this per connection? */
+ enum cache_mode mode;
switch (next_ops->can_cache (nxdata)) {
case NBDKIT_CACHE_NONE:
@@ -440,8 +447,7 @@ cow_cache (struct nbdkit_next_ops *next_ops, void *nxdata,
mode = BLK_CACHE_PASSTHROUGH;
break;
default:
- *err = EINVAL;
- return -1;
+ abort (); /* .prepare populated the cache */
}
if (cow_on_cache)
mode = BLK_CACHE_COW;
--
2.21.0