Displaying 20 results from an estimated 94 matches for "nbdkit_flag_may_trim".
2019 Aug 23
1
[nbdkit PATCH 1/3] server: Add internal support for NBDKIT_FLAG_FAST_ZERO
..._can_extents (struct backend *b, struct connection *conn)
{
@@ -738,7 +750,8 @@ filter_zero (struct backend *b, struct connection *conn,
void *handle = connection_get_handle (conn, f->backend.i);
struct b_conn nxdata = { .b = f->backend.next, .conn = conn };
- assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA)));
+ assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA |
+ NBDKIT_FLAG_FAST_ZERO)));
debug ("%s: zero count=%" PRIu32 " offset=%" PRIu64 " flags=0x%" PRIx32,
f->name, count, offset, flags);
@@ -818,...
2019 May 09
1
[nbdkit PATCH] plugins: Use static buffer for plugin_zeroes
...ct connection *conn,
uint32_t count, uint64_t offset, uint32_t flags, int *err)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
- char *buf;
+ static const char buf[MAX_REQUEST_SIZE];
uint32_t limit;
int r = -1;
bool may_trim = flags & NBDKIT_FLAG_MAY_TRIM;
@@ -639,12 +639,7 @@ plugin_zero (struct backend *b, struct connection *conn,
assert (p->plugin.pwrite || p->plugin._pwrite_old);
flags &= ~NBDKIT_FLAG_MAY_TRIM;
threadlocal_set_error (0);
- limit = count < MAX_REQUEST_SIZE ? count : MAX_REQUEST_SIZE;
- buf = calloc (limit,...
2019 Aug 23
2
[nbdkit PATCH 3/3] plugins: Add .can_fast_zero hook
...honor the semantics
+of C<NBDKIT_FLAG_FAST_ZERO>).
=head2 C<.can_extents>
@@ -804,15 +832,25 @@ bytes of zeroes at C<offset> in the backing store.
This function will not be called if C<.can_zero> returned false. On
input, the parameter C<flags> may include C<NBDKIT_FLAG_MAY_TRIM>
-unconditionally, and C<NBDKIT_FLAG_FUA> based on the result of
-C<.can_fua>.
+unconditionally, C<NBDKIT_FLAG_FUA> based on the result of
+C<.can_fua>, and C<NBDKIT_FLAG_FAST_ZERO> based on the result of
+C<.can_fast_zero>.
If C<NBDKIT_FLAG_MAY_TRIM>...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...will ever be passed to a data callback.
=item C<.close>
@@ -152,6 +173,58 @@ is called once just before the plugin is unloaded from memory.
=back
+=head1 Flags
+
+The following flags are defined by nbdkit, and used in various data
+serving callbacks as follows:
+
+=over 4
+
+=item C<NBDKIT_FLAG_MAY_TRIM>
+
+This flag is used by the C<.zero> callback; a plugin may ignore it
+without changing valid semantics, so there is no way to disable this
+flag.
+
+=item C<NBDKIT_FLAG_FUA>
+
+This flag represents Forced Unit Access semantics. It is used by the
+C<.pwrite>, C<.zero>,...
2018 Apr 11
0
[nbdkit PATCH v2 3/5] python: Update internals to plugin API level 2
...fset)
}
static int
-py_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)
+py_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
{
PyObject *obj = handle;
PyObject *fn;
PyObject *args;
PyObject *kwargs;
PyObject *r;
+ int may_trim = (flags & NBDKIT_FLAG_MAY_TRIM) != 0;
+ assert (!(flags & ~NBDKIT_FLAG_MAY_TRIM));
if (callback_defined ("zero", &fn)) {
static int zero_may_trim = -1;
--
2.14.3
2018 Jan 19
2
[nbdkit PATCH] Update filters to support FUA flags.
...void *handle, uint32_t count, uint64_t offset, int may_trim);
+ void *handle, uint32_t count, uint64_t offset,
+ uint32_t flags);
This intercepts the plugin C<.zero> method and can be used to modify
zero requests.
+At this time, flags may include C<NBDKIT_FLAG_MAY_TRIM>
+unconditionally, and C<NBDKIT_FLAG_FUA> based on the result of
+C<.can_flush>. In turn, when calling C<next_ops->zero>, the filter may
+pass C<NBDKIT_FLAG_MAY_TRIM> unconditionally, but may only pass
+C<NBDKIT_FLAG_FUA> if C<next_ops->can_flush> retur...
2019 Nov 22
2
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...IZE_REQUESTS",
> + NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS);
> + PyModule_AddIntConstant (m, "THREAD_MODEL_PARALLEL",
> + NBDKIT_THREAD_MODEL_PARALLEL);
> +
> + PyModule_AddIntConstant (m, "FLAG_MAY_TRIM", NBDKIT_FLAG_MAY_TRIM);
> + PyModule_AddIntConstant (m, "FLAG_FUA", NBDKIT_FLAG_FUA);
> + PyModule_AddIntConstant (m, "FLAG_REQ_ONE", NBDKIT_FLAG_REQ_ONE);
> + PyModule_AddIntConstant (m, "FLAG_FAST_ZERO", NBDKIT_FLAG_FAST_ZERO);
> +
> + PyModule_AddIntConstant (m...
2019 Nov 25
6
[nbdkit PATCH 0/5] Counterproposal for python v2 interfaces
As mentioned in my reviews, I wonder if we should make our python
callbacks look a bit more Pythonic by having kwargs added for each
new flag that we want to expose. The idea was first floated here:
https://www.redhat.com/archives/libguestfs/2018-April/msg00108.html
Note that with my proposal, there is no need for a python script to
expose a global API_VERSION variable; new flags are added
2019 Aug 23
22
cross-project patches: Add NBD Fast Zero support
This is a cover letter to a series of patches being proposed in tandem
to four different projects:
- nbd: Document a new NBD_CMD_FLAG_FAST_ZERO command flag
- qemu: Implement the flag for both clients and server
- libnbd: Implement the flag for clients
- nbdkit: Implement the flag for servers, including the nbd passthrough
client
If you want to test the patches together, I've pushed a
2018 Mar 22
1
[nbdkit PATCH] plugins: Add .can_zero callback
...k is used to write C<count>
bytes of zeroes at C<offset> in the backing store.
-This function will not be called if C<.can_write> returned false. On
+This function will not be called if C<.can_zero> returned false. On
input, the parameter C<flags> may include C<NBDKIT_FLAG_MAY_TRIM>
unconditionally, and C<NBDKIT_FLAG_FUA> based on the result of
C<.can_fua>.
@@ -826,6 +845,7 @@ and then users will be able to run it like this:
L<nbdkit(1)>,
L<nbdkit-filter(3)>,
+L<nbdkit-nozero-filter(3)>,
L<nbdkit-example1-plugin(1)>,
L<nbdkit-e...
2019 May 10
1
[nbdkit PATCH] nozero: Add notrim mode
...te;
+ return zeromode != NONE;
}
static int
@@ -81,11 +105,15 @@ nozero_zero (struct nbdkit_next_ops *next_ops, void *nxdata,
void *handle, uint32_t count, uint64_t offs, uint32_t flags,
int *err)
{
- assert (emulate);
+ assert (zeromode != NONE);
+ flags &= ~NBDKIT_FLAG_MAY_TRIM;
+
+ if (zeromode == NOTRIM)
+ return next_ops->zero (nxdata, count, offs, flags, err);
+
while (count) {
uint32_t size = MIN (count, MAX_WRITE);
- if (next_ops->pwrite (nxdata, buffer, size, offs,
- flags & ~NBDKIT_FLAG_MAY_TRIM, err) == -1)
+ i...
2018 Apr 11
0
[nbdkit PATCH v2 4/5] python: Expose FUA support
...ount, uint64_t offset, uint32_t flags)
return -1;
}
- return 0;
+ return need_flush ? py_flush (handle, 0) : 0;
}
static int
@@ -556,8 +643,10 @@ py_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
PyObject *kwargs;
PyObject *r;
int may_trim = (flags & NBDKIT_FLAG_MAY_TRIM) != 0;
+ int fua = (flags & NBDKIT_FLAG_FUA) != 0;
+ int need_flush = fua && !zero_has_fua;
- assert (!(flags & ~NBDKIT_FLAG_MAY_TRIM));
+ assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA)));
if (callback_defined ("zero", &fn)) {
static int z...
2019 Nov 22
1
Re: [PATCH nbdkit v2 02/10] python: Add various constants to the API.
...NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS);
> > > + PyModule_AddIntConstant (m, "THREAD_MODEL_PARALLEL",
> > > + NBDKIT_THREAD_MODEL_PARALLEL);
> > > +
> > > + PyModule_AddIntConstant (m, "FLAG_MAY_TRIM", NBDKIT_FLAG_MAY_TRIM);
> > > + PyModule_AddIntConstant (m, "FLAG_FUA", NBDKIT_FLAG_FUA);
> > > + PyModule_AddIntConstant (m, "FLAG_REQ_ONE", NBDKIT_FLAG_REQ_ONE);
> > > + PyModule_AddIntConstant (m, "FLAG_FAST_ZERO", NBDKIT_FLAG_FAST_ZERO);
> > &...
2018 Mar 08
19
[nbdkit PATCH v3 00/15] Add FUA support to nbdkit
After more than a month since v2 [1], I've finally got my FUA
support series polished. This is all of my outstanding patches,
even though some of them were originally posted in separate
threads from the original FUA post [2], [3]
[1] https://www.redhat.com/archives/libguestfs/2018-January/msg00113.html
[2] https://www.redhat.com/archives/libguestfs/2018-January/msg00219.html
[3]
2019 Aug 13
3
[nbdkit PATCH 0/2] more fast zero prep
Another couple things I noticed that are worth improving, but aren't
strictly related to implementing fast zero support.
Eric Blake (2):
server: Assert sane error responses
nozero: More efficient FUA handling
filters/nozero/nozero.c | 17 +++++++++++--
server/filters.c | 56 +++++++++++++++++++++++++++++++++--------
server/protocol.c | 32 +++++++++++++++++------
3 files
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...= p->plugin.trim (connection_get_handle (conn), count, offset);
+ r = p->plugin.trim (connection_get_handle (conn, 0), count, offset);
else {
errno = EINVAL;
return -1;
@@ -438,7 +439,7 @@ plugin_zero (struct backend *b, struct connection *conn,
int may_trim = (flags & NBDKIT_FLAG_MAY_TRIM) != 0;
bool fua = flags & NBDKIT_FLAG_FUA;
- assert (connection_get_handle (conn));
+ assert (connection_get_handle (conn, 0));
assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA)));
debug ("zero count=%" PRIu32 " offset=%" PRIu64 " may_trim=%d...
2019 Aug 30
0
[nbdkit PATCH 9/9] server: Move command validation from protocol.c to backend.c
...(r == -1)
assert (*err);
@@ -343,6 +414,7 @@ backend_zero (struct backend *b, struct connection *conn,
uint32_t count, uint64_t offset, uint32_t flags,
int *err)
{
+ struct b_conn_handle *h = &conn->handles[b->i];
int r;
assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA)));
@@ -350,6 +422,20 @@ backend_zero (struct backend *b, struct connection *conn,
b->name, count, offset, !!(flags & NBDKIT_FLAG_MAY_TRIM),
!!(flags & NBDKIT_FLAG_FUA));
+ if (writes_blocked (b, conn, "zero", flags)) {
+ *err = EROFS;...
2018 Jan 19
0
[nbdkit PATCH v2 13/13] RFC: plugins: Add callbacks for FUA semantics
...yright (C) 2013-2018 Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,16 @@ extern "C" {
#define NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS 2
#define NBDKIT_THREAD_MODEL_PARALLEL 3
+#define NBDKIT_FLAG_MAY_TRIM (1<<0)
+#define NBDKIT_FLAG_FUA (1<<1)
+
+/* By default, a plugin gets API version 1; but you may request
+ * version 2 prior to including this header */
+#ifndef NBDKIT_API_VERSION
#define NBDKIT_API_VERSION 1
+#elif (NBDKIT_API_VERS...
2019 Aug 13
0
[nbdkit PATCH 2/2] nozero: More efficient FUA handling
...conditions are
@@ -102,12 +102,22 @@ nozero_zero (struct nbdkit_next_ops *next_ops, void *nxdata,
void *handle, uint32_t count, uint64_t offs, uint32_t flags,
int *err)
{
+ int writeflags = 0;
+ bool need_flush = false;
+
assert (zeromode != NONE);
flags &= ~NBDKIT_FLAG_MAY_TRIM;
if (zeromode == NOTRIM)
return next_ops->zero (nxdata, count, offs, flags, err);
+ if (flags & NBDKIT_FLAG_FUA) {
+ if (next_ops->can_fua (nxdata) == NBDKIT_FUA_EMULATE)
+ need_flush = true;
+ else
+ writeflags = NBDKIT_FLAG_FUA;
+ }
+
while (count) {...
2019 Nov 22
0
[PATCH nbdkit v2 02/10] python: Add various constants to the API.
..."THREAD_MODEL_SERIALIZE_REQUESTS",
+ NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS);
+ PyModule_AddIntConstant (m, "THREAD_MODEL_PARALLEL",
+ NBDKIT_THREAD_MODEL_PARALLEL);
+
+ PyModule_AddIntConstant (m, "FLAG_MAY_TRIM", NBDKIT_FLAG_MAY_TRIM);
+ PyModule_AddIntConstant (m, "FLAG_FUA", NBDKIT_FLAG_FUA);
+ PyModule_AddIntConstant (m, "FLAG_REQ_ONE", NBDKIT_FLAG_REQ_ONE);
+ PyModule_AddIntConstant (m, "FLAG_FAST_ZERO", NBDKIT_FLAG_FAST_ZERO);
+
+ PyModule_AddIntConstant (m, "FUA_NONE",...