Displaying 20 results from an estimated 51 matches for "plugin_can_trim".
2017 Nov 15
1
[nbdkit PATCH] connections: Extract common export flag computation code
...(fl == -1)
+ return -1;
+ if (fl) {
+ eflags |= NBD_FLAG_SEND_FLUSH | NBD_FLAG_SEND_FUA;
+ conn->can_flush = 1;
+ }
+
+ fl = plugin_is_rotational (conn);
+ if (fl == -1)
+ return -1;
+ if (fl) {
+ eflags |= NBD_FLAG_ROTATIONAL;
+ conn->is_rotational = 1;
+ }
+
+ fl = plugin_can_trim (conn);
+ if (fl == -1)
+ return -1;
+ if (fl) {
+ eflags |= NBD_FLAG_SEND_TRIM;
+ conn->can_trim = 1;
+ }
+
+ *flags = eflags;
+ return 0;
+}
+
+static int
_negotiate_handshake_oldstyle (struct connection *conn)
{
struct old_handshake handshake;
int64_t r;
uint64_t expo...
2016 Sep 27
1
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...ue)
plugin_config_complete (void)
plugin_open (struct connection *conn, int readonly)
plugin_close (struct connection *conn)
plugin_get_size (struct connection *conn)
plugin_can_write (struct connection *conn)
plugin_can_flush (struct connection *conn)
plugin_is_rotational (struct connection *conn)
plugin_can_trim (struct connection *conn)
That means dumping the plugin-internal data on connection close is not
locked against the requests within that connection, and any garbage
collection triggered by the last request may still be running while
plugin_close runs. Boom.
In general, when working with python an...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...gs)
conn->can_flush = 1;
}
- fl = plugin_is_rotational (conn);
+ fl = backend->is_rotational (backend, conn);
if (fl == -1)
return -1;
if (fl) {
@@ -379,7 +381,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
conn->is_rotational = 1;
}
- fl = plugin_can_trim (conn);
+ fl = backend->can_trim (backend, conn);
if (fl == -1)
return -1;
if (fl) {
@@ -407,7 +409,7 @@ _negotiate_handshake_oldstyle (struct connection *conn)
return -1;
}
- r = plugin_get_size (conn);
+ r = backend->get_size (backend, conn);
if (r == -1)
ret...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...gs)
conn->can_flush = 1;
}
- fl = plugin_is_rotational (conn);
+ fl = backend->is_rotational (backend, conn);
if (fl == -1)
return -1;
if (fl) {
@@ -379,7 +381,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
conn->is_rotational = 1;
}
- fl = plugin_can_trim (conn);
+ fl = backend->can_trim (backend, conn);
if (fl == -1)
return -1;
if (fl) {
@@ -407,7 +409,7 @@ _negotiate_handshake_oldstyle (struct connection *conn)
return -1;
}
- r = plugin_get_size (conn);
+ r = backend->get_size (backend, conn);
if (r == -1)
ret...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...gs)
conn->can_flush = 1;
}
- fl = plugin_is_rotational (conn);
+ fl = backend->is_rotational (backend, conn);
if (fl == -1)
return -1;
if (fl) {
@@ -379,7 +381,7 @@ compute_eflags (struct connection *conn, uint16_t *flags)
conn->is_rotational = 1;
}
- fl = plugin_can_trim (conn);
+ fl = backend->can_trim (backend, conn);
if (fl == -1)
return -1;
if (fl) {
@@ -407,7 +409,7 @@ _negotiate_handshake_oldstyle (struct connection *conn)
return -1;
}
- r = plugin_get_size (conn);
+ r = backend->get_size (backend, conn);
if (r == -1)
ret...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2:
- Fixed everything mentioned in the review.
Rich.
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are
called. This patch is in preparation for adding a second backend
subtype for filters.
Rich.
2020 Mar 17
0
[nbdkit PATCH 1/4] server: Normalize plugin can_* values
...le)
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
if (p->plugin.is_rotational)
- return p->plugin.is_rotational (handle);
+ return normalize_bool (p->plugin.is_rotational (handle));
else
return 0; /* assume false */
}
@@ -347,7 +355,7 @@ plugin_can_trim (struct backend *b, void *handle)
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
if (p->plugin.can_trim)
- return p->plugin.can_trim (handle);
+ return normalize_bool (p->plugin.can_trim (handle));
else
return p->plugin.trim || p->pl...
2020 Mar 17
1
Re: [nbdkit PATCH 1/4] server: Normalize plugin can_* values
...ner_of (b, struct backend_plugin, backend);
>
> if (p->plugin.is_rotational)
> - return p->plugin.is_rotational (handle);
> + return normalize_bool (p->plugin.is_rotational (handle));
> else
> return 0; /* assume false */
> }
> @@ -347,7 +355,7 @@ plugin_can_trim (struct backend *b, void *handle)
> struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
>
> if (p->plugin.can_trim)
> - return p->plugin.can_trim (handle);
> + return normalize_bool (p->plugin.can_trim (handle));
> else
> r...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...conn, 0));
debug ("is_rotational");
if (p->plugin.is_rotational)
- return p->plugin.is_rotational (connection_get_handle (conn));
+ return p->plugin.is_rotational (connection_get_handle (conn, 0));
else
return 0; /* assume false */
}
@@ -329,12 +329,12 @@ plugin_can_trim (struct backend *b, struct connection *conn)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
- assert (connection_get_handle (conn));
+ assert (connection_get_handle (conn, 0));
debug ("can_trim");
if (p->plugin.can_trim)
- return p-&...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...(conn, 0));
debug ("is_rotational");
if (p->plugin.is_rotational)
- return p->plugin.is_rotational (connection_get_handle (conn));
+ return p->plugin.is_rotational (connection_get_handle (conn, 0));
else
return 0; /* assume false */
}
@@ -329,12 +329,12 @@ plugin_can_trim (struct backend *b, struct connection *conn)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
- assert (connection_get_handle (conn));
+ assert (connection_get_handle (conn, 0));
debug ("can_trim");
if (p->plugin.can_trim)
- return p->...
2017 Feb 20
1
Re: Fwd: nbdkit async
The concern is a client is blocked while processing a request. The nbdkit
server design requires a thread per request being processed regardless of
the number of connections or clients. We want to run 1000's of requests in
parallel without needing a thread at nbdkit layer per request in flight.
Our plugin layer is built around boost asio and a few threads in a worker
pool running an io
2019 Jan 04
0
[PATCH nbdkit 1/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.
...eturn p->plugin.can_multi_conn (connection_get_handle (conn, 0));
+ else
+ return 0; /* assume false */
+}
+
/* Plugins and filters can call this to set the true errno, in cases
* where !errno_is_preserved.
*/
@@ -656,6 +672,7 @@ static struct backend plugin_functions = {
.can_trim = plugin_can_trim,
.can_zero = plugin_can_zero,
.can_fua = plugin_can_fua,
+ .can_multi_conn = plugin_can_multi_conn,
.pread = plugin_pread,
.pwrite = plugin_pwrite,
.flush = plugin_flush,
diff --git a/tests/test-layers-filter.c b/tests/test-layers-filter.c
index c5a96e7..6da6ee6 100644
--- a/tests/t...
2018 Jan 24
0
[nbdkit PATCH 2/3] filter: Add .can_zero/.can_fua overrides
...uint32_t flags);
+ int (*can_zero) (struct backend *, struct connection *conn);
+ int (*can_fua) (struct backend *, struct connection *conn);
};
/* plugins.c */
diff --git a/src/plugins.c b/src/plugins.c
index dba3e24..3468b6d 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -358,6 +358,26 @@ plugin_can_trim (struct backend *b, struct connection *conn)
return p->plugin.trim != NULL;
}
+static int
+plugin_can_zero (struct backend *b, struct connection *conn)
+{
+ debug ("can_zero");
+
+ // We always allow .zero to fall back to .write, so plugins don't
+ // need to override thi...
2019 Aug 23
1
[nbdkit PATCH 1/3] server: Add internal support for NBDKIT_FLAG_FAST_ZERO
...);
+ *err = EOPNOTSUPP;
+ goto done;
+ }
+
assert (p->plugin.pwrite || p->plugin._pwrite_old);
flags &= ~NBDKIT_FLAG_MAY_TRIM;
threadlocal_set_error (0);
@@ -762,6 +783,7 @@ static struct backend plugin_functions = {
.is_rotational = plugin_is_rotational,
.can_trim = plugin_can_trim,
.can_zero = plugin_can_zero,
+ .can_fast_zero = plugin_can_fast_zero,
.can_extents = plugin_can_extents,
.can_fua = plugin_can_fua,
.can_multi_conn = plugin_can_multi_conn,
diff --git a/server/protocol-handshake.c b/server/protocol-handshake.c
index 0f3bd280..84fcacfd 100644
--- a/ser...
2018 Jan 24
8
[nbdkit PATCH 0/3] Add nozero filter
I still need to add testsuite coverage. Perhaps it might be easier
if I create a new '--filter=log logfile=foo' filter that produces
a log of which commands a client sent, then compare the log using
a known client that uses write_zeroes (qemu-io works well) both
with and without --filter=nozero to prove that the change in
advertisement changes the commands sent over the wire (that would
2019 Aug 19
2
[nbdkit PATCH] noextents: Add hook to cripple SR advertisement
...ith no exposure
+ * to the plugin interface; only filters can change it.
+ */
+ return 1;
+}
+
static int
plugin_can_extents (struct backend *b, struct connection *conn)
{
@@ -761,6 +772,7 @@ static struct backend plugin_functions = {
.is_rotational = plugin_is_rotational,
.can_trim = plugin_can_trim,
.can_zero = plugin_can_zero,
+ .can_sr = plugin_can_sr,
.can_extents = plugin_can_extents,
.can_fua = plugin_can_fua,
.can_multi_conn = plugin_can_multi_conn,
diff --git a/server/protocol-handshake-newstyle.c b/server/protocol-handshake-newstyle.c
index e0136de1..518de703 100644
--- a...
2019 Mar 12
0
[PATCH nbdkit] server: Implement extents/can_extents calls for plugins and filters.
...NBDKIT_EXTENT_TYPE_DATA;
+ *nr_extents = 1;
+ return 0;
+ }
+}
+
static struct backend plugin_functions = {
.free = plugin_free,
.thread_model = plugin_thread_model,
@@ -672,6 +740,7 @@ static struct backend plugin_functions = {
.is_rotational = plugin_is_rotational,
.can_trim = plugin_can_trim,
.can_zero = plugin_can_zero,
+ .can_extents = plugin_can_extents,
.can_fua = plugin_can_fua,
.can_multi_conn = plugin_can_multi_conn,
.pread = plugin_pread,
@@ -679,6 +748,7 @@ static struct backend plugin_functions = {
.flush = plugin_flush,
.trim = plugin_trim,
.zero = plug...
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far.
Rich.
2018 Jan 17
14
[PATCH 0/9] Add filters to nbdkit.
The first three patches are identical to:
https://www.redhat.com/archives/libguestfs/2018-January/msg00079.html
"[PATCH nbdkit v2 0/3] Refactor plugin_* functions into a backend"
The rest of the patches add filters using the new filter API
previously described here:
https://www.redhat.com/archives/libguestfs/2018-January/msg00073.html
This needs a lot more testing -- and tests --