Displaying 20 results from an estimated 59 matches for "plugin_flush".
2018 Feb 13
0
[nbdkit PATCH 2/2] plugins: Consistent error handling on FUA
...c
index 699e9c5..1b0816c 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -412,7 +412,7 @@ plugin_pwrite (struct backend *b, struct connection *conn,
errno = EROFS;
return -1;
}
- if (r == 0 && fua) {
+ if (r != -1 && fua) {
assert (p->plugin.flush);
r = plugin_flush (b, conn, 0);
}
@@ -439,7 +439,7 @@ plugin_trim (struct backend *b, struct connection *conn,
errno = EINVAL;
return -1;
}
- if (r == 0 && fua) {
+ if (r != -1 && fua) {
assert (p->plugin.flush);
r = plugin_flush (b, conn, 0);
}
@@ -503,7 +503,7 @@ p...
2018 Feb 13
3
[nbdkit PATCH 0/2] Consistent plugin return value handling
While working on improving the backend interface to allow filters
to handle errors, I noticed that I've introduced some minor
incompatibilities for filters that don't quite obey the documentation
which states that a callback should return only 0/-1. Prior to
my additions, we treated all plugin returns other than -1 as success
(sort of makes sense for a positive return, particularly if a
2019 Aug 13
3
[nbdkit PATCH 0/2] errno cleanup patches
I ran into these while trying to prepare patches to add
NBD_CMD_FLAG_FAST_ZERO, which will expose a new NBD_ENOTSUP wire
value.
Eric Blake (2):
plugins: Don't lose original error when emulating FUA
plugins: Permit ENOTSUP as synonym for EOPNOTSUPP
docs/nbdkit-filter.pod | 11 ++++++-----
docs/nbdkit-plugin.pod | 12 +++++++-----
plugins/file/file.c | 16 +++++++++++-----
2018 Jul 01
2
[PATCH nbdkit] Add Tcl plugin, for writing plugins in Tcl.
...disk. You should write C<$count> bytes to the disk starting at
+C<$offset>.
+
+NBD only supports whole writes, so your function should try to write
+the whole region (perhaps requiring a loop). If the write fails or is
+partial, your function should call C<error>.
+
+=item C<plugin_flush>
+
+(Optional)
+
+ proc plugin_flush {h} {
+ # No return value
+ }
+
+The body of your C<plugin_flush> function should do a L<sync(2)> or
+L<fdatasync(2)> or equivalent on the backing store.
+
+=item C<trim>
+
+(Optional)
+
+ proc trim {h count offset} {
+ # No re...
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
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...f, 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)
return get_error (conn);
break;
case NBD_CMD_FLUSH:
- if (plugin_flush (conn) == -1)
+ if (backend->flush (backend, conn) == -1)
return get_error (conn);
break;
case NBD_CMD_TRIM:
- if (plugin_trim (conn, count, offset) == -1)
+ if (backend->trim (backend, conn, count, offset) == -1)
return get_error (conn);
break;
case...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...f, 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)
return get_error (conn);
break;
case NBD_CMD_FLUSH:
- if (plugin_flush (conn) == -1)
+ if (backend->flush (backend, conn) == -1)
return get_error (conn);
break;
case NBD_CMD_TRIM:
- if (plugin_trim (conn, count, offset) == -1)
+ if (backend->trim (backend, conn, count, offset) == -1)
return get_error (conn);
break;
case...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...f, 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)
return get_error (conn);
break;
case NBD_CMD_FLUSH:
- if (plugin_flush (conn) == -1)
+ if (backend->flush (backend, conn) == -1)
return get_error (conn);
break;
case NBD_CMD_TRIM:
- if (plugin_trim (conn, count, offset) == -1)
+ if (backend->trim (backend, conn, count, offset) == -1)
return get_error (conn);
break;
case...
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
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.
2017 Jan 26
0
[nbdkit PATCH v2 4/6] plugins: Add new nbdkit_set_error() utility function
...*conn,
case NBD_CMD_WRITE:
r = plugin_pwrite (conn, buf, count, offset);
if (r == -1) {
- *error = errno ? errno : EIO;
+ *error = _get_error ();
return 0;
}
break;
@@ -648,7 +666,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_FLUSH:
r = plugin_flush (conn);
if (r == -1) {
- *error = errno ? errno : EIO;
+ *error = _get_error ();
return 0;
}
break;
@@ -656,7 +674,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_TRIM:
r = plugin_trim (conn, count, offset);
if (r == -1) {
- *error = err...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...ugin.pread (connection_get_handle (conn, 0), buf, count, offset,
+ 0);
+ else
+ r = p->plugin._pread_old (connection_get_handle (conn, 0), buf, count,
+ offset);
if (r == -1)
*err = get_error (p);
return r;
@@ -421,16 +438,17 @@ plugin_flush (struct backend *b, struct connection *conn, uint32_t flags,
debug ("flush");
- if (p->plugin.flush != NULL) {
- r = p->plugin.flush (connection_get_handle (conn, 0));
- if (r == -1)
- *err = get_error (p);
- return r;
- }
+ if (p->plugin.flush)
+ r = p-&...
2018 Feb 01
0
[nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics
...t=%" PRIu32 " offset=%" PRIu64, count, offset);
- return p->plugin.pread (connection_get_handle (conn, 0), buf, count, offset);
+ r = p->plugin.pread (connection_get_handle (conn, 0), buf, count, offset);
+ if (r < 0)
+ r = get_error (p);
+ return r;
}
static int
plugin_flush (struct backend *b, struct connection *conn, uint32_t flags)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
+ int r;
assert (connection_get_handle (conn, 0));
assert (!flags);
debug ("flush");
- if (p->plugin.flush != NULL)
- return...
2017 Feb 20
1
Re: Fwd: nbdkit async
..._command;
struct operation *op = (struct operation *) vop;
flush_after_command = (op->flags & NBD_CMD_FLAG_FUA) != 0;
if (!op->conn->can_flush || op->conn->readonly)
flush_after_command = false;
if (flush_after_command) {
op->flags = 0; // clear flags
r = plugin_flush_lowlevel (op, op->conn->handle);
if (r == -1)
// do error stuff;
}
else if (op->cmd == NBD_CMD_READ)
send_reply(op, op->buf, op->count, 0);
else
send_reply(op, NULL, 0, 0);
}
int
my_plugin_pwrite_lowlevel (void *op, void *handle, void *buf,...
2017 Jan 27
0
[nbdkit PATCH v3 1/4] plugins: Don't use bogus errno from non-C plugins
...onn,
case NBD_CMD_WRITE:
r = plugin_pwrite (conn, buf, count, offset);
if (r == -1) {
- *error = errno ? errno : EIO;
+ *error = get_error (conn);
return 0;
}
break;
@@ -648,7 +662,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_FLUSH:
r = plugin_flush (conn);
if (r == -1) {
- *error = errno ? errno : EIO;
+ *error = get_error (conn);
return 0;
}
break;
@@ -656,7 +670,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_TRIM:
r = plugin_trim (conn, count, offset);
if (r == -1) {
- *error =...
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...struct connection *conn, void *handle,
+plugin_pread (struct backend *b, void *handle,
void *buf, uint32_t count, uint64_t offset, uint32_t flags,
int *err)
{
@@ -473,7 +473,7 @@ plugin_pread (struct backend *b, struct connection *conn, void *handle,
}
static int
-plugin_flush (struct backend *b, struct connection *conn, void *handle,
+plugin_flush (struct backend *b, void *handle,
uint32_t flags, int *err)
{
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
@@ -493,7 +493,7 @@ plugin_flush (struct backend *b, struct connecti...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here:
https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html
v2 replaces
struct connection *conn = GET_CONN;
with
GET_CONN;
which sets conn implicitly and asserts that it is non-NULL.
If we actually want to test if conn is non-NULL or behave
differently, then you must use threadlocal_get_conn() instead,
and some existing uses do that.
Rich.
2020 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of
passing around struct connection * entirely within the server,
preferring instead to reference the connection through thread-local
storage.
I hope this is a gateway to simplifying other parts of the code.
Rich.
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