Displaying 20 results from an estimated 119 matches for "nbdkit_flag_fua".
2019 May 25
1
[nbdkit PATCH] nbd: Rewrite thread passing to use semaphore rather than pipe
...);
+ return s ? nbd_reply (h, s) : -1;
}
/* Write data to the file. */
@@ -1188,12 +1188,12 @@ nbd_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
uint32_t flags)
{
struct handle *h = handle;
- int c;
+ struct transaction *s;
assert (!(flags & ~NBDKIT_FLAG_FUA));
- c = nbd_request_full (h, flags & NBDKIT_FLAG_FUA ? NBD_CMD_FLAG_FUA : 0,
+ s = nbd_request_full (h, flags & NBDKIT_FLAG_FUA ? NBD_CMD_FLAG_FUA : 0,
NBD_CMD_WRITE, offset, count, buf, NULL, NULL);
- return c < 0 ? c : nbd_reply (h, c);
+ return s ? nbd_re...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...still work. The new API adds .can_fua, then adds a flags parameter
to all five data callbacks, even though only three of them will use
a flag at the moment. A plugin client has to opt in to both the
version 2 API and provide .can_fua with a return of NBDKIT_FUA_NATIVE
before nbdkit will pass the NBDKIT_FLAG_FUA to the plugin.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
docs/nbdkit-filter.pod | 12 ++--
docs/nbdkit-plugin.pod | 151 +++++++++++++++++++++++++++++++++++++++++++-----
docs/nbdkit.pod | 7 ++-
include/nbdkit-plugin.h | 30 ++++++++++
src/internal.h | 1 +...
2019 Aug 23
1
[nbdkit PATCH 1/3] server: Add internal support for NBDKIT_FLAG_FAST_ZERO
...ckend *b, struct connection *conn)
{
@@ -738,7 +750,8 @@ filter_zero (struct backend *b, struct connection *conn,
void *handle = connection_get_handle (conn, f->backend.i);
struct b_conn nxdata = { .b = f->backend.next, .conn = conn };
- assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA)));
+ assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FUA |
+ NBDKIT_FLAG_FAST_ZERO)));
debug ("%s: zero count=%" PRIu32 " offset=%" PRIu64 " flags=0x%" PRIx32,
f->name, count, offset, flags);
@@ -818,6 +831,7 @@ static...
2018 Jan 19
2
[nbdkit PATCH] Update filters to support FUA flags.
...const void *buf, uint32_t count, uint64_t offset);
+ const void *buf, uint32_t count, uint64_t offset,
+ uint32_t flags);
This intercepts the plugin C<.pwrite> method and can be used to modify
data written by the plugin.
+At this time, flags may include C<NBDKIT_FLAG_FUA> on input based on
+the result of C<.can_flush>. In turn, the filter may only pass
+C<NBDKIT_FLAG_FUA> on to C<next_ops->pwrite> if C<next_ops->can_flush>
+returned true.
+
+This function will not be called if C<.can_write> returned false; in
+turn, the filte...
2020 May 22
0
[PATCH nbdkit 4/4] fua: Add unsafe fuamode=discard.
...*nxdata, void *handle)
return NBDKIT_FUA_EMULATE;
case NATIVE:
case FORCE:
+ case DISCARD:
return NBDKIT_FUA_NATIVE;
case PASS:
return next_ops->can_fua (nxdata);
@@ -167,6 +180,9 @@ fua_pwrite (struct nbdkit_next_ops *next_ops, void *nxdata,
case FORCE:
flags |= NBDKIT_FLAG_FUA;
break;
+ case DISCARD:
+ flags &= ~NBDKIT_FLAG_FUA;
+ break;
}
r = next_ops->pwrite (nxdata, buf, count, offs, flags, err);
if (r != -1 && need_flush)
@@ -178,9 +194,18 @@ static int
fua_flush (struct nbdkit_next_ops *next_ops, void *nxdata,
void *h...
2019 Jul 01
3
[nbdkit PATCH 0/2] Use new libnbd _notify functions
I'm not observing any noticeable performance differences, but I'm
liking the diffstat. I can't push this patch until we release a new
libnbd version with the _notify API addition, but am posting it now
for playing with things.
Eric Blake (2):
nbd: Move transaction info from heap to stack
nbd: Use nbdkit aio_*_notify variants
plugins/nbd/nbd.c | 217
2019 Aug 13
3
[nbdkit PATCH 0/2] more fast zero prep
Another couple things I noticed that are worth improving, but aren't
strictly related to implementing fast zero support.
Eric Blake (2):
server: Assert sane error responses
nozero: More efficient FUA handling
filters/nozero/nozero.c | 17 +++++++++++--
server/filters.c | 56 +++++++++++++++++++++++++++++++++--------
server/protocol.c | 32 +++++++++++++++++------
3 files
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...+ return p->plugin.flush (connection_get_handle (conn, 0));
else {
errno = EINVAL;
return -1;
@@ -380,14 +380,15 @@ plugin_pwrite (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));
debug ("pwrite count=%" PRIu32 " offset=%" PRIu64 " fua=%d", count, offset,
fua);
if (p->plugin.pwrite != NULL)
-...
2019 Jul 17
3
[nbdkit PATCH 0/2] Another libnbd API bump
libnbd 0.1.7 was released today, which breaks compilation of
nbdkit-nbd-plugin. We could work around it by using #ifdef
LIBNBD_HAVE_XXX to learn about the renamed functions, but supporting
older versions is not all that important when we don't yet have API
stability. So patch 1 copes by just bumping the minimum version
instead, except that we have yet another pending libnbd patch with an
API
2019 Aug 13
0
[nbdkit PATCH 2/2] nozero: More efficient FUA handling
...count, uint64_t offs, uint32_t flags,
int *err)
{
+ int writeflags = 0;
+ bool need_flush = false;
+
assert (zeromode != NONE);
flags &= ~NBDKIT_FLAG_MAY_TRIM;
if (zeromode == NOTRIM)
return next_ops->zero (nxdata, count, offs, flags, err);
+ if (flags & NBDKIT_FLAG_FUA) {
+ if (next_ops->can_fua (nxdata) == NBDKIT_FUA_EMULATE)
+ need_flush = true;
+ else
+ writeflags = NBDKIT_FLAG_FUA;
+ }
+
while (count) {
/* Always contains zeroes, but we can't use const or else gcc 9
* will use .rodata instead of .bss and inflate the binar...
2018 Mar 08
19
[nbdkit PATCH v3 00/15] Add FUA support to nbdkit
After more than a month since v2 [1], I've finally got my FUA
support series polished. This is all of my outstanding patches,
even though some of them were originally posted in separate
threads from the original FUA post [2], [3]
[1] https://www.redhat.com/archives/libguestfs/2018-January/msg00113.html
[2] https://www.redhat.com/archives/libguestfs/2018-January/msg00219.html
[3]
2018 Apr 11
0
[nbdkit PATCH v2 4/5] python: Expose FUA support
...+static int py_flush (void *handle, uint32_t flags);
+
static int
py_pwrite (void *handle, const void *buf,
uint32_t count, uint64_t offset, uint32_t flags)
{
PyObject *obj = handle;
PyObject *fn;
+ PyObject *args;
+ PyObject *kwargs;
PyObject *r;
+ int fua = (flags & NBDKIT_FLAG_FUA) != 0;
+ int need_flush = fua && !pwrite_has_fua;
- assert (!flags);
+ assert (!(flags & ~NBDKIT_FLAG_FUA));
if (callback_defined ("pwrite", &fn)) {
PyErr_Clear ();
- r = PyObject_CallFunction (fn, "ONL", obj,
- PyByt...
2019 Aug 30
0
[nbdkit PATCH 9/9] server: Move command validation from protocol.c to backend.c
...t flags)
+{
+ struct b_conn_handle *h = &conn->handles[b->i];
+
+ assert (h->can_write >= 0);
+ if (h->can_write == 0) {
+ nbdkit_error ("invalid request: %s: write request on readonly connection",
+ cmd);
+ return true;
+ }
+ if (flags & NBDKIT_FLAG_FUA) {
+ assert (h->can_fua >= 0);
+ if (h->can_fua == 0) {
+ nbdkit_error ("invalid request: %s: FUA flag not supported", cmd);
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool
+invalid_range (struct backend *b, struct connection *conn, const char *cmd,...
2020 May 22
6
[PATCH nbdkit 0/4] Add fuamode=pass and fuamode=discard
Two hopefully useful additions to the fua filter. The second one is
kind of like cache=unsafe in qemu, in that it exchanges correctness
for speed. Useful for data which is easily recreated in the event of
a crash or for people who like living on the edge and have good
backups.
Rich.
2019 Jan 05
0
[PATCH nbdkit v2 07/11] file: Implement NBDKIT_API_VERSION 2.
...nt64_t offset)
+file_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
+ uint32_t flags)
{
struct handle *h = handle;
@@ -304,6 +328,9 @@ file_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset)
offset += r;
}
+ if ((flags & NBDKIT_FLAG_FUA) && file_flush (handle, 0) == -1)
+ return -1;
+
return 0;
}
@@ -323,20 +350,20 @@ do_fallocate(int fd, int mode, off_t offset, off_t len)
/* Write zeroes to the file. */
static int
-file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)
+file_zero (void *handl...
2019 Aug 23
2
[nbdkit PATCH 3/3] plugins: Add .can_fast_zero hook
...gt;).
=head2 C<.can_extents>
@@ -804,15 +832,25 @@ bytes of zeroes at C<offset> in the backing store.
This function will not be called if C<.can_zero> returned false. On
input, the parameter C<flags> may include C<NBDKIT_FLAG_MAY_TRIM>
-unconditionally, and C<NBDKIT_FLAG_FUA> based on the result of
-C<.can_fua>.
+unconditionally, C<NBDKIT_FLAG_FUA> based on the result of
+C<.can_fua>, and C<NBDKIT_FLAG_FAST_ZERO> based on the result of
+C<.can_fast_zero>.
If C<NBDKIT_FLAG_MAY_TRIM> is requested, the operation can punch a
hole i...
2019 May 13
0
[nbdkit PATCH v2 2/2] cache, cow: Reduce use of bounce-buffer
...*err = errno;
- nbdkit_error ("malloc: %m");
- return -1;
+ if (!IS_ALIGNED (count | offset, blksize)) {
+ block = malloc (blksize);
+ if (block == NULL) {
+ *err = errno;
+ nbdkit_error ("malloc: %m");
+ return -1;
+ }
}
if ((flags & NBDKIT_FLAG_FUA) &&
@@ -294,19 +325,18 @@ cache_pwrite (struct nbdkit_next_ops *next_ops, void *nxdata,
flags &= ~NBDKIT_FLAG_FUA;
need_flush = true;
}
- while (count > 0) {
- uint64_t blknum, blkoffs, n;
- int r;
- blknum = offset / blksize; /* block number */
- blkoffs...
2019 Aug 30
0
[nbdkit PATCH 6/9] server: Cache per-connection can_FOO flags
...r/plugins.c
@@ -509,7 +509,7 @@ plugin_pwrite (struct backend *b, struct connection *conn,
assert (connection_get_handle (conn, 0));
- if (fua && plugin_can_fua (b, conn) != NBDKIT_FUA_NATIVE) {
+ if (fua && backend_can_fua (b, conn) != NBDKIT_FUA_NATIVE) {
flags &= ~NBDKIT_FLAG_FUA;
need_flush = true;
}
@@ -541,7 +541,7 @@ plugin_trim (struct backend *b, struct connection *conn,
assert (connection_get_handle (conn, 0));
- if (fua && plugin_can_fua (b, conn) != NBDKIT_FUA_NATIVE) {
+ if (fua && backend_can_fua (b, conn) != NBDKIT_FUA_NATIVE) {...
2020 Aug 07
2
[PATCH nbdkit] plugins: file: More standard cache mode names
...be flushed to disk so we can immediately evict them from
- * the page cache.
+ /* If cache=writethrough we want to force pages we have just written
+ * to the file to be flushed to disk so we can immediately evict them
+ * from the page cache.
*/
- if (cache_mode == cache_none) flags |= NBDKIT_FLAG_FUA;
+ if (cache_mode == cache_writethrough) flags |= NBDKIT_FLAG_FUA;
#endif
while (count > 0) {
@@ -464,7 +464,7 @@ file_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset,
#ifdef HAVE_POSIX_FADVISE
/* On Linux this will evict the pages we just wrote from the page...
2019 Aug 30
15
[nbdkit PATCH 0/9] can_FOO caching, more filter validation
It's easy to use the sh script to demonstrate that nbdkit is
inefficiently calling into .get_size, .can_fua, and friends more than
necessary. We've also commented on the list in the past that it would
be nice to ensure that when filters call into next_ops, they are not
violating constraints (as we've have to fix several bugs in the past
where we did not have such checking to protect