search for: plugin_can_flush

Displaying 20 results from an estimated 36 matches for "plugin_can_flush".

2017 Nov 15
1
[nbdkit PATCH] connections: Extract common export flag computation code
...uint16_t eflags = NBD_FLAG_HAS_FLAGS; + int fl; + + fl = plugin_can_write (conn); + if (fl == -1) + return -1; + if (readonly || !fl) { + eflags |= NBD_FLAG_READ_ONLY; + conn->readonly = 1; + } + if (!conn->readonly) { + eflags |= NBD_FLAG_SEND_WRITE_ZEROES; + } + + fl = plugin_can_flush (conn); + if (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; +...
2016 Sep 27
1
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...nst char *_filename, plugin_cleanup (void) plugin_config (const char *key, const char *value) 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...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
..._HAS_FLAGS; int fl; - fl = plugin_can_write (conn); + fl = backend->can_write (backend, conn); if (fl == -1) return -1; if (readonly || !fl) { @@ -363,7 +365,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) eflags |= NBD_FLAG_SEND_WRITE_ZEROES; } - fl = plugin_can_flush (conn); + fl = backend->can_flush (backend, conn); if (fl == -1) return -1; if (fl) { @@ -371,7 +373,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) conn->can_flush = 1; } - fl = plugin_is_rotational (conn); + fl = backend->is_rotational (backend, con...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
..._HAS_FLAGS; int fl; - fl = plugin_can_write (conn); + fl = backend->can_write (backend, conn); if (fl == -1) return -1; if (readonly || !fl) { @@ -363,7 +365,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) eflags |= NBD_FLAG_SEND_WRITE_ZEROES; } - fl = plugin_can_flush (conn); + fl = backend->can_flush (backend, conn); if (fl == -1) return -1; if (fl) { @@ -371,7 +373,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) conn->can_flush = 1; } - fl = plugin_is_rotational (conn); + fl = backend->is_rotational (backend, con...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
..._HAS_FLAGS; int fl; - fl = plugin_can_write (conn); + fl = backend->can_write (backend, conn); if (fl == -1) return -1; if (readonly || !fl) { @@ -363,7 +365,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) eflags |= NBD_FLAG_SEND_WRITE_ZEROES; } - fl = plugin_can_flush (conn); + fl = backend->can_flush (backend, conn); if (fl == -1) return -1; if (fl) { @@ -371,7 +373,7 @@ compute_eflags (struct connection *conn, uint16_t *flags) conn->can_flush = 1; } - fl = plugin_is_rotational (conn); + fl = backend->is_rotational (backend, con...
2017 Nov 15
1
[nbdkit PATCH] connections: Improve error responses
We had several inconsistencies from the NBD spec when diagnosing bad client messages: - FLUSH is not generally forbidden on a read-only export (so failing with EPERM is wrong) [meanwhile, if we don't advertise flush because plugin_can_flush() fails, then rejecting with EINVAL is still okay] - returning EPERM (aka EROFS) for read-only exports should probably take precedence over anything else - out-of-bounds WRITE and WRITE_ZEROES should fail with ENOSPC, not EIO - out-of-bounds READ and TRIM should fail with EINVAL, not EIO We also h...
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
...backend_plugin *p = container_of (b, struct backend_plugin, backend); if (p->plugin.can_write) - return p->plugin.can_write (handle); + return normalize_bool (p->plugin.can_write (handle)); else return p->plugin.pwrite || p->plugin._pwrite_v1; } @@ -325,7 +333,7 @@ plugin_can_flush (struct backend *b, void *handle) struct backend_plugin *p = container_of (b, struct backend_plugin, backend); if (p->plugin.can_flush) - return p->plugin.can_flush (handle); + return normalize_bool (p->plugin.can_flush (handle)); else return p->plugin.flush || p-&g...
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
2020 Mar 17
1
Re: [nbdkit PATCH 1/4] server: Normalize plugin can_* values
...uct backend_plugin, backend); > > if (p->plugin.can_write) > - return p->plugin.can_write (handle); > + return normalize_bool (p->plugin.can_write (handle)); > else > return p->plugin.pwrite || p->plugin._pwrite_v1; > } > @@ -325,7 +333,7 @@ plugin_can_flush (struct backend *b, void *handle) > struct backend_plugin *p = container_of (b, struct backend_plugin, backend); > > if (p->plugin.can_flush) > - return p->plugin.can_flush (handle); > + return normalize_bool (p->plugin.can_flush (handle)); > else >...
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 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
..._handle (conn, 0)); debug ("can_write"); if (p->plugin.can_write) - return p->plugin.can_write (connection_get_handle (conn)); + return p->plugin.can_write (connection_get_handle (conn, 0)); else return p->plugin.pwrite != NULL; } @@ -299,12 +299,12 @@ plugin_can_flush (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_flush"); if (p->plugin.can_flush) - return p...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...et_handle (conn, 0)); debug ("can_write"); if (p->plugin.can_write) - return p->plugin.can_write (connection_get_handle (conn)); + return p->plugin.can_write (connection_get_handle (conn, 0)); else return p->plugin.pwrite != NULL; } @@ -299,12 +299,12 @@ plugin_can_flush (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_flush"); if (p->plugin.can_flush) - return p-&g...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...n_write (struct backend *b, struct connection *conn) if (p->plugin.can_write) return p->plugin.can_write (connection_get_handle (conn, 0)); else - return p->plugin.pwrite != NULL; + return p->plugin.pwrite || p->plugin._pwrite_old; } static int @@ -316,7 +322,7 @@ plugin_can_flush (struct backend *b, struct connection *conn) if (p->plugin.can_flush) return p->plugin.can_flush (connection_get_handle (conn, 0)); else - return p->plugin.flush != NULL; + return p->plugin.flush || p->plugin._flush_old; } static int @@ -346,7 +352,7 @@ plugin_can...
2018 Jan 24
0
[nbdkit PATCH 2/3] filter: Add .can_zero/.can_fua overrides
...rride this + return plugin_can_write (b, conn); +} + +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,...
2017 Feb 06
0
[PATCH 1/2] Define .errno_is_preserved constant instead of a .errno_is_reliable callback.
...nt plugin_open (struct connection *conn, int readonly); extern void plugin_close (struct connection *conn); extern int64_t plugin_get_size (struct connection *conn); -extern int plugin_errno_is_reliable (struct connection *conn); extern int plugin_can_write (struct connection *conn); extern int plugin_can_flush (struct connection *conn); extern int plugin_is_rotational (struct connection *conn); diff --git a/src/plugins.c b/src/plugins.c index 837a54f..eeed8a9 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -236,6 +236,7 @@ plugin_dump_fields (void) break; } printf ("\n"); + print...
2017 Jan 27
0
[nbdkit PATCH v3 1/4] plugins: Don't use bogus errno from non-C plugins
...nt plugin_open (struct connection *conn, int readonly); extern void plugin_close (struct connection *conn); extern int64_t plugin_get_size (struct connection *conn); +extern int plugin_errno_is_reliable (struct connection *conn); extern int plugin_can_write (struct connection *conn); extern int plugin_can_flush (struct connection *conn); extern int plugin_is_rotational (struct connection *conn); diff --git a/src/plugins.c b/src/plugins.c index 92f8505..d486f2d 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -395,6 +395,21 @@ plugin_get_size (struct connection *conn) } int +plugin_errno_is_reliable (...
2017 Feb 06
3
[PATCH nbdkit 0/2] Change .errno_is_reliable function to .errno_is_preserved constant.
See patch 1 for rationale.
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