Displaying 20 results from an estimated 52 matches for "plugin_trim".
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...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 NBD_CMD_WRITE_ZEROES:
- if (plugin_zero (conn, count, offset,
- !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1)
+ if (backend->...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...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 NBD_CMD_WRITE_ZEROES:
- if (plugin_zero (conn, count, offset,
- !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1)
+ if (backend->...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...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 NBD_CMD_WRITE_ZEROES:
- if (plugin_zero (conn, count, offset,
- !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1)
+ if (backend->...
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
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 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 Feb 13
0
[nbdkit PATCH 2/2] plugins: Consistent error handling on FUA
...+++ 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 @@ plugin_zero (struct backend *b, struct connection *c...
2017 Jan 20
7
[nbdkit PATCH 0/5] Add WRITE_ZEROES support
The upstream protocol recently promoted NBD_CMD_WRITE_ZEROES from
experimental to a documented extension. Exposing support for this
allows plugin writers to create sparse files when driven by a
client that knows how to use the extension; meanwhile, even if a
plugin does not support this extension, the server benefits from
less network traffic from the client.
Eric Blake (5):
protocol: Support
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
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...ion *conn);
-extern bool plugin_is_parallel (void);
extern int plugin_errno_is_preserved (void);
extern int plugin_open (struct connection *conn, int readonly);
extern void plugin_close (struct connection *conn);
@@ -169,6 +165,14 @@ extern int plugin_flush (struct connection *conn);
extern int plugin_trim (struct connection *conn, uint32_t count, uint64_t offset);
extern int plugin_zero (struct connection *conn, uint32_t count, uint64_t offset, int may_trim);
+/* locks.c */
+extern void lock_connection (void);
+extern void unlock_connection (void);
+extern void lock_request (struct connection *co...
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...ion *conn);
-extern bool plugin_is_parallel (void);
extern int plugin_errno_is_preserved (void);
extern int plugin_open (struct connection *conn, int readonly);
extern void plugin_close (struct connection *conn);
@@ -169,6 +165,14 @@ extern int plugin_flush (struct connection *conn);
extern int plugin_trim (struct connection *conn, uint32_t count, uint64_t offset);
extern int plugin_zero (struct connection *conn, uint32_t count, uint64_t offset, int may_trim);
+/* locks.c */
+extern void lock_connection (void);
+extern void unlock_connection (void);
+extern void lock_request (struct connection *co...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...onnection_get_handle (conn, 0));
debug ("flush");
if (p->plugin.flush != NULL)
- return p->plugin.flush (connection_get_handle (conn));
+ return p->plugin.flush (connection_get_handle (conn, 0));
else {
errno = EINVAL;
return -1;
@@ -394,12 +395,12 @@ plugin_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 ("trim count=%" PRIu32 " offset=%" PRIu64, count, o...
2017 Jan 26
0
[nbdkit PATCH v2 4/6] plugins: Add new nbdkit_set_error() utility function
...est (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 = errno ? errno : EIO;
+ *error = _get_error ();
return 0;
}
break;
@@ -664,7 +682,7 @@ _handle_request (struct connection *conn,
case NBD_CMD_WRITE_ZEROES:
r = plugin_zero (conn, count, offset, !(flags & NBD...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...);
if (p->plugin.pwrite != NULL)
- r = p->plugin.pwrite (connection_get_handle (conn), buf, count, offset);
+ r = p->plugin.pwrite (connection_get_handle (conn, 0),
+ buf, count, offset);
else {
errno = EROFS;
return -1;
@@ -407,14 +408,14 @@ plugin_trim (struct backend *b, struct connection *conn,
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
bool fua = flags & NBDKIT_FLAG_FUA;
- assert (connection_get_handle (conn));
+ assert (connection_get_handle (conn, 0));
assert (!(flags & ~NBDKIT_FLAG_FUA))...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...-1;
}
- if (r != -1 && fua) {
- assert (p->plugin.flush);
- r = p->plugin.flush (connection_get_handle (conn, 0));
- }
+ if (r != -1 && need_flush)
+ r = plugin_flush (b, conn, 0, err);
if (r == -1)
*err = get_error (p);
return r;
@@ -471,6 +495,7 @@ plugin_trim (struct backend *b, struct connection *conn,
int r;
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
bool fua = flags & NBDKIT_FLAG_FUA;
+ bool need_flush = false;
assert (connection_get_handle (conn, 0));
assert (!(flags & ~NBDKIT_FLAG_FUA));
@@...
2018 Jan 24
0
[nbdkit PATCH 2/3] filter: Add .can_zero/.can_fua overrides
...mulate 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_fua = plugin_can_fua,
};
/* Register and load a plugin. */
--
2.14.3
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 +++++++++++-----
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
2019 May 10
0
[nbdkit PATCH 1/9] server: Internal hooks for implementing NBD_CMD_CACHE
...-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
--- a/server/protocol-handshake.c
+++ b/server/protocol-handshake.c
@@ -109,7...