Displaying 20 results from an estimated 21 matches for "cache_none".
2020 Aug 07
2
[PATCH nbdkit] plugins: file: More standard cache mode names
...| 2 +-
3 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/plugins/file/file.c b/plugins/file/file.c
index f6f91955..deac9b7f 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -76,7 +76,7 @@ static int fadvise_mode =
;
/* cache mode */
-static enum { cache_default, cache_none } cache_mode = cache_default;
+static enum { cache_writeback, cache_writethrough } cache_mode = cache_writeback;
/* Any callbacks using lseek must be protected by this lock. */
static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -140,10 +140,10 @@ file_config (const char *key, con...
2020 Aug 08
0
Re: [PATCH nbdkit] plugins: file: More standard cache mode names
...letions(-)
>
> diff --git a/plugins/file/file.c b/plugins/file/file.c
> index f6f91955..deac9b7f 100644
> --- a/plugins/file/file.c
> +++ b/plugins/file/file.c
> @@ -76,7 +76,7 @@ static int fadvise_mode =
> ;
>
> /* cache mode */
> -static enum { cache_default, cache_none } cache_mode = cache_default;
> +static enum { cache_writeback, cache_writethrough } cache_mode = cache_writeback;
>
> /* Any callbacks using lseek must be protected by this lock. */
> static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
> @@ -140,10 +140,10 @@ file_con...
2020 Aug 07
3
[PATCH nbdkit] file: Implement cache=none and fadvise=normal|random|sequential.
...static char *filename = NULL;
+/* posix_fadvise mode: -1 = don't set it, or POSIX_FADV_*. */
+static int fadvise_mode =
+#if defined (HAVE_POSIX_FADVISE) && defined (POSIX_FADV_NORMAL)
+ POSIX_FADV_NORMAL
+#else
+ -1
+#endif
+ ;
+
+/* cache mode */
+static enum { cache_default, cache_none } cache_mode = cache_default;
+
/* Any callbacks using lseek must be protected by this lock. */
static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -97,6 +109,46 @@ file_config (const char *key, const char *value)
if (!filename)
return -1;
}
+ else if (strcmp (key,...
2020 Aug 08
1
Re: [PATCH nbdkit] plugins: file: More standard cache mode names
...gins/file/file.c b/plugins/file/file.c
> > index f6f91955..deac9b7f 100644
> > --- a/plugins/file/file.c
> > +++ b/plugins/file/file.c
> > @@ -76,7 +76,7 @@ static int fadvise_mode =
> > ;
> >
> > /* cache mode */
> > -static enum { cache_default, cache_none } cache_mode = cache_default;
> > +static enum { cache_writeback, cache_writethrough } cache_mode = cache_writeback;
> >
> > /* Any callbacks using lseek must be protected by this lock. */
> > static pthread_mutex_t lseek_lock = PTHREAD_MUTEX_INITIALIZER;
> > @@ -140...
2019 Nov 22
2
Re: [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);
>...
2020 Aug 07
3
Re: [PATCH nbdkit] file: Implement cache=none and fadvise=normal|random|sequential.
...= count;
> >+ uint64_t orig_offset = offset;
> >+
> >+ /* If cache=none we want to force pages we have just written to the
> >+ * file to be flushed to disk so we can immediately evict them from
> >+ * the page cache.
> >+ */
> >+ if (cache_mode == cache_none) flags |= NBDKIT_FLAG_FUA;
> >+#endif
> >+
> > while (count > 0) {
> > ssize_t r = pwrite (h->fd, buf, count, offset);
> > if (r == -1) {
> >@@ -369,6 +453,12 @@ file_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
>...
2020 Aug 07
0
Re: [PATCH nbdkit] file: Implement cache=none and fadvise=normal|random|sequential.
...> + uint32_t orig_count = count;
> + uint64_t orig_offset = offset;
> +
> + /* If cache=none we want to force pages we have just written to the
> + * file to be flushed to disk so we can immediately evict them from
> + * the page cache.
> + */
> + if (cache_mode == cache_none) flags |= NBDKIT_FLAG_FUA;
> +#endif
> +
> while (count > 0) {
> ssize_t r = pwrite (h->fd, buf, count, offset);
> if (r == -1) {
> @@ -369,6 +453,12 @@ file_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
> if ((flags & NBD...
2019 Nov 22
1
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...t;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...
2020 Aug 07
0
Re: [PATCH nbdkit] file: Implement cache=none and fadvise=normal|random|sequential.
...orig_offset = offset;
> > >+
> > >+ /* If cache=none we want to force pages we have just written to the
> > >+ * file to be flushed to disk so we can immediately evict them from
> > >+ * the page cache.
> > >+ */
> > >+ if (cache_mode == cache_none) flags |= NBDKIT_FLAG_FUA;
> > >+#endif
> > >+
> > > while (count > 0) {
> > > ssize_t r = pwrite (h->fd, buf, count, offset);
> > > if (r == -1) {
> > >@@ -369,6 +453,12 @@ file_pwrite (void *handle, const void *buf,
> uin...
2019 Nov 22
0
[PATCH nbdkit v2 02/10] python: Add various constants to the API.
...BDKIT_FLAG_FAST_ZERO);
+
+ 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_AddIntConst...
2019 Nov 22
0
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...IntConstant (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", NBDK...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...ython/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
> index b20f51f7..d7b6033f 100644
> --- a/plugins/python/nbdkit-python-plugin.pod
> +++ b/plugins/python/nbdkit-python-plugin.pod
> @@ -271,6 +271,13 @@ contents will 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_...
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...-)
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
index b20f51f7..d7b6033f 100644
--- a/plugins/python/nbdkit-python-plugin.pod
+++ b/plugins/python/nbdkit-python-plugin.pod
@@ -271,6 +271,13 @@ contents will be garbage collected.
# return nbdkit.CACHE_NONE or nbdkit.CACHE_EMULATE
# or nbdkit.CACHE_NATIVE
+=item C<can_extents>
+
+(Optional)
+
+ def can_extents(h):
+ # return a boolean
+
=item C<pread>
(Required)
@@ -365,6 +372,14 @@ indicated range.
If the cache operation fails, your function should throw an exception,
option...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
> index b20f51f7..d7b6033f 100644
> --- a/plugins/python/nbdkit-python-plugin.pod
> +++ b/plugins/python/nbdkit-python-plugin.pod
> @@ -271,6 +271,13 @@ contents will be garbage collected.
> # return nbdkit.CACHE_NONE or nbdkit.CACHE_EMULATE
> # or nbdkit.CACHE_NATIVE
>
> +=item C<can_extents>
> +
> +(Optional)
> +
> + def can_extents(h):
> + # return a boolean
> +
> =item C<pread>
>
> (Required)
> @@ -365,6 +372,14 @@ indicated range.
> If the cache...
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 Nov 25
7
[PATCH nbdkit v2 0/7] Implement nbdkit API v2 for Python plugins.
v3 was here:
https://www.redhat.com/archives/libguestfs/2019-November/msg00209.html
In v4:
- Rebase on top of current master. Includes various fixes and
updates required because of Nir's patches that went into master.
- Fix api_version() -> API_VERSION in patch 2 noted previously on the
mailing list.
Rich.
2019 Nov 23
8
[PATCH nbdkit v3 0/7] Implement nbdkit API v2 for Python plugins.
v2 was here:
https://www.redhat.com/archives/libguestfs/2019-November/msg00163.html
I pushed patch 1 (with spelling fix), patch 4 and patch 5 since those
were previously ACKed on the list.
Differences in v3:
- Add error checking to PyModule_AddIntConstant.
- Use API_VERSION constant instead of function.
- Add max API version supported to --dump-plugin output.
- Print API_VERSION selected by
2019 Nov 22
0
[PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...nbdkit.FUA_NONE
+ elif fua == "emulate":
+ return nbdkit.FUA_EMULATE
+ elif fua == "native":
+ return nbdkit.FUA_NATIVE
+
+def can_cache(h):
+ cache = cfg.get ('can_cache', "none")
+ if cache == "none":
+ return nbdkit.CACHE_NONE
+ elif cache == "emulate":
+ return nbdkit.CACHE_EMULATE
+ elif cache == "native":
+ return nbdkit.CACHE_NATIVE
+
+def pread(h, count, offset, flags):
+ assert flags == 0
+ return h['disk'][offset:offset+count]
+
+def pwrite(h, buf, offset, flag...
2019 Nov 22
3
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...mulate":
> + return nbdkit.FUA_EMULATE
> + elif fua == "native":
> + return nbdkit.FUA_NATIVE
> +
> +def can_cache(h):
> + cache = cfg.get ('can_cache', "none")
> + if cache == "none":
> + return nbdkit.CACHE_NONE
> + elif cache == "emulate":
> + return nbdkit.CACHE_EMULATE
> + elif cache == "native":
> + return nbdkit.CACHE_NATIVE
> +
> +def pread(h, count, offset, flags):
> + assert flags == 0
> + return h['disk'][offset:offset+c...
2019 Nov 21
10
[PATCH nbdkit 0/8] Implement nbdkit API v2 for Python plugins.
And fill out most of the missing bits of the API.
Rich.