Displaying 20 results from an estimated 56 matches for "plugin_pread".
2018 Feb 01
2
Re: [nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics
...cit -1 value return from the plugin
would trigger returning an error code to the client; all other values
(whether -2, 0, or positive, even though the documentation only
mentioned 0 as valid) would treat things as success on the reply to the
client.
> +++ b/src/plugins.c
> static int
> plugin_pread (struct backend *b, struct connection *conn,
> void *buf, uint32_t count, uint64_t offset, uint32_t flags)
> {
> struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
> + int r;
>
> assert (connection_get_handle (conn, 0));
> as...
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
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...cal_get_error ();
- if (!ret && plugin_errno_is_preserved ())
+ if (!ret && backend->errno_is_preserved (backend))
ret = errno;
return ret ? ret : EIO;
}
@@ -881,28 +883,28 @@ handle_request (struct connection *conn,
switch (cmd) {
case NBD_CMD_READ:
- if (plugin_pread (conn, buf, count, offset) == -1)
+ if (backend->pread (backend, conn, buf, count, offset) == -1)
return get_error (conn);
break;
case NBD_CMD_WRITE:
- if (plugin_pwrite (conn, buf, count, offset) == -1)
+ if (backend->pwrite (backend, conn, buf, count, offset) == -1...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...cal_get_error ();
- if (!ret && plugin_errno_is_preserved ())
+ if (!ret && backend->errno_is_preserved (backend))
ret = errno;
return ret ? ret : EIO;
}
@@ -881,28 +883,28 @@ handle_request (struct connection *conn,
switch (cmd) {
case NBD_CMD_READ:
- if (plugin_pread (conn, buf, count, offset) == -1)
+ if (backend->pread (backend, conn, buf, count, offset) == -1)
return get_error (conn);
break;
case NBD_CMD_WRITE:
- if (plugin_pwrite (conn, buf, count, offset) == -1)
+ if (backend->pwrite (backend, conn, buf, count, offset) == -1...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...cal_get_error ();
- if (!ret && plugin_errno_is_preserved ())
+ if (!ret && backend->errno_is_preserved (backend))
ret = errno;
return ret ? ret : EIO;
}
@@ -881,28 +883,28 @@ handle_request (struct connection *conn,
switch (cmd) {
case NBD_CMD_READ:
- if (plugin_pread (conn, buf, count, offset) == -1)
+ if (backend->pread (backend, conn, buf, count, offset) == -1)
return get_error (conn);
break;
case NBD_CMD_WRITE:
- if (plugin_pwrite (conn, buf, count, offset) == -1)
+ if (backend->pwrite (backend, conn, buf, count, offset) == -1...
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.
2018 Jan 16
0
[PATCH nbdkit 3/3] Fix const-correctness of backend pwrite method.
...struct connection *conn, uint32_t count, uint64_t offset);
int (*zero) (struct backend *, struct connection *conn, uint32_t count, uint64_t offset, int may_trim);
diff --git a/src/plugins.c b/src/plugins.c
index e81a3d3..dfa9bc5 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -357,7 +357,7 @@ plugin_pread (struct backend *b, struct connection *conn,
static int
plugin_pwrite (struct backend *b, struct connection *conn,
- void *buf, uint32_t count, uint64_t offset)
+ const void *buf, uint32_t count, uint64_t offset)
{
struct backend_plugin *p = (struct backend_plugi...
2018 Jan 16
9
[nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
Tested via:
term1$ qemu-nbd -k $PWD/sock -t -f raw -x foo junk --trace=nbd_\*
term2$ ./nbdkit -f -v -e bar nbd socket=$PWD/sock export=foo
term3$ qemu-io -t none -f raw nbd://localhost:10809/bar --trace=nbd_\*
and checking the traces to see that 'w 0 1' vs. 'w -f 0 1' was able
to influence whether the FUA flag showed up at the server in term1.
Still to go: figure out how to
2020 Aug 05
5
[PATCH NOT WORKING nbdkit 0/3] python: Allow thread model to be set from Python plugins.
...Object_CallFunction_SizeT (callable=<optimized out>, format=<optimized out>) at /usr/src/debug/python3.9-3.9.0~b3-1.fc33.x86_64/Objects/call.c:596
#13 0x00007fc4b9f7b840 in py_pread (handle=0x9ee9f20, buf=0x9f98ca0, count=512, offset=0, flags=0) at python.c:619
#14 0x0000000000410d89 in plugin_pread (b=0x9f07040, handle=0x9ee9f20, buf=0x9f98ca0, count=512, offset=0, flags=0, err=0x7fc4ab220a78) at plugins.c:524
#15 0x000000000040653f in backend_pread (b=0x9f07040, buf=0x9f98ca0, count=512, offset=0, flags=0, err=0x7fc4ab220a78) at backend.c:485
#16 0x0000000000411f7e in handle_request (cmd=0,...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...on_get_handle (conn, 0));
debug ("can_trim");
if (p->plugin.can_trim)
- return p->plugin.can_trim (connection_get_handle (conn));
+ return p->plugin.can_trim (connection_get_handle (conn, 0));
else
return p->plugin.trim != NULL;
}
@@ -345,12 +345,12 @@ plugin_pread (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));
assert (p->plugin.pread != NULL);
debug ("pread count=%" PRIu...
2017 Jan 26
0
[nbdkit PATCH v2 4/6] plugins: Add new nbdkit_set_error() utility function
...nnection *conn,
if (!conn->can_flush || conn->readonly)
flush_after_command = false;
+ /* The plugin should call nbdkit_set_error() to request a particular
+ error, otherwise we fallback to errno or EIO. */
+ tls_set_error (0);
+
switch (cmd) {
case NBD_CMD_READ:
r = plugin_pread (conn, buf, count, offset);
if (r == -1) {
- *error = errno ? errno : EIO;
+ *error = _get_error ();
return 0;
}
break;
@@ -640,7 +658,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_WRITE:
r = plugin_pwrite (conn, buf, count, offset);
if (r...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...tion_get_handle (conn, 0));
debug ("can_trim");
if (p->plugin.can_trim)
- return p->plugin.can_trim (connection_get_handle (conn));
+ return p->plugin.can_trim (connection_get_handle (conn, 0));
else
return p->plugin.trim != NULL;
}
@@ -345,13 +345,13 @@ plugin_pread (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));
assert (p->plugin.pread != NULL);
assert (!flags);
debug ("pread...
2018 Feb 01
0
[nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics
...return p->plugin.trim != NULL;
}
+/* Grab the appropriate error value.
+ */
+static int
+get_error (struct backend_plugin *p)
+{
+ int ret = threadlocal_get_error ();
+
+ if (!ret && p->plugin.errno_is_preserved)
+ ret = errno;
+ return ret ? ret : EIO;
+}
+
static int
plugin_pread (struct backend *b, struct connection *conn,
void *buf, uint32_t count, uint64_t offset, uint32_t flags)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
+ int r;
assert (connection_get_handle (conn, 0));
assert (p->plugin.pread != NULL);...
2019 Jan 04
0
[PATCH nbdkit 1/7] server: Implement NBD_FLAG_CAN_MULTI_CONN.
...ters 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/test-layers-filter.c
+++ b/tests/test-layers-filter.c
@@ -167,6 +167,15 @@ test_layers_filter_can_fua (struct nbdkit_next_ops *next_o...
2018 Jan 24
0
[nbdkit PATCH 2/3] filter: Add .can_zero/.can_fua overrides
...);
+}
+
+static int
+plugin_can_fua (struct backend *b, struct connection *conn)
+{
+ debug ("can_fua");
+
+ // TODO - wire FUA flag support into plugins. Until then, this copies
+ // can_flush, since that's how we emulate FUA
+ return plugin_can_flush (b, conn);
+}
+
static int
plugin_pread (struct backend *b, struct connection *conn,
void *buf, uint32_t count, uint64_t offset, uint32_t flags)
@@ -535,6 +555,8 @@ static struct backend plugin_functions = {
.flush = plugin_flush,
.trim = plugin_trim,
.zero = plugin_zero,
+ .can_zero = plugin_can_zero,
+ .can_fu...
2018 Jan 19
2
Re: [nbdkit PATCH v2 13/13] RFC: plugins: Add callbacks for FUA semantics
...internal projects.
I have uploaded the entire cbdkit source to our github at
https://github.com/dev-cloudbd/cbdkit
The relevant files are
include/cbdkit-plugin.h
src/connections.c
src/plugins.c
Specifically, the connections.c functions
recv_request
send_reply
and the plugins.c functions
plugin_pread
plugin_pwrite
cbdkit_async_reply
cbdkit_async_reply_read
cbdkit_async_reply_error
On Fri, Jan 19, 2018 at 12:05 PM, Eric Blake <eblake@redhat.com> wrote:
> On 01/19/2018 10:56 AM, Shaun McDowell wrote:
>
> > Limitation: The kernel will (with today's default settings) typ...
2019 May 10
0
[nbdkit PATCH 1/9] server: Internal hooks for implementing NBD_CMD_CACHE
...unctions = {
.free = plugin_free,
.thread_model = plugin_thread_model,
@@ -717,12 +749,14 @@ static struct backend plugin_functions = {
.can_extents = plugin_can_extents,
.can_fua = plugin_can_fua,
.can_multi_conn = plugin_can_multi_conn,
+ .can_cache = plugin_can_cache,
.pread = plugin_pread,
.pwrite = plugin_pwrite,
.flush = plugin_flush,
.trim = plugin_trim,
.zero = plugin_zero,
.extents = plugin_extents,
+ .cache = plugin_cache,
};
/* Register and load a plugin. */
diff --git a/server/protocol-handshake.c b/server/protocol-handshake.c
index 03377a9..af1cd18 100644...
2018 Jan 19
16
[nbdkit PATCH v2 00/13] Add filters + FUA support to nbdkit
A combination of the work that both Rich and I have been doing
lately, where filters use only the new API with flags on every
command that the client can send over the wire (we can then
add support for more flags in nbdkit without having to add new
callbacks, as NBD adds more flags upstream).
Eric Blake (4):
protocol: Split flags from cmd field in requests
backend: Pass flags argument through
2017 Jan 27
0
[nbdkit PATCH v3 1/4] plugins: Don't use bogus errno from non-C plugins
...te errors, sets *error to errno (or EIO if errno is not
- * set) and returns 0.
+ * On read/write errors, sets *error appropriately and returns 0.
*/
static int
_handle_request (struct connection *conn,
@@ -632,7 +646,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_READ:
r = plugin_pread (conn, buf, count, offset);
if (r == -1) {
- *error = errno ? errno : EIO;
+ *error = get_error (conn);
return 0;
}
break;
@@ -640,7 +654,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_WRITE:
r = plugin_pwrite (conn, buf, count, offset);
if...