search for: nbd_aio_pwrit

Displaying 20 results from an estimated 59 matches for "nbd_aio_pwrit".

Did you mean: nbd_aio_pwrite
2019 Jun 28
3
[libnbd PATCH] tests: Enhance errors test
...are rejected */ + if (nbd_pread (nbd, buf, MAXSIZE, 0, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_pread did not fail with oversize request\n", + argv[0]); + exit (EXIT_FAILURE); + } + check (ERANGE, "nbd_pread: "); + if (nbd_aio_pwrite (nbd, buf, MAXSIZE, 0, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_aio_pwrite did not fail with oversize request\n", + argv[0]); + exit (EXIT_FAILURE); + } + check (ERANGE, "nbd_aio_pwrite: "); + + /* Queue up a write com...
2019 Jun 30
0
Re: [libnbd PATCH] tests: Enhance errors test
On Thu, Jun 27, 2019 at 10:18:30PM -0500, Eric Blake wrote: > + /* Queue up a write command so large that we block on POLLIN, then queue > + * multiple disconnects. XXX The last one should fail. > + */ > + if (nbd_aio_pwrite (nbd, buf, 2 * 1024 * 1024, 0, 0) == -1) { > + fprintf (stderr, "%s: %s\n", argv[0], nbd_get_error ()); > + exit (EXIT_FAILURE); > + } > + if ((nbd_aio_get_direction (nbd) & LIBNBD_AIO_DIRECTION_WRITE) == 0) { > + fprintf (stderr, "%s: test failed: &quo...
2019 Jul 02
1
Re: [libnbd PATCH] tests: Enhance errors test
On 6/30/19 12:54 PM, Richard W.M. Jones wrote: > On Thu, Jun 27, 2019 at 10:18:30PM -0500, Eric Blake wrote: >> + /* Queue up a write command so large that we block on POLLIN, then queue >> + * multiple disconnects. XXX The last one should fail. >> + */ >> + if (nbd_aio_pwrite (nbd, buf, 2 * 1024 * 1024, 0, 0) == -1) { >> + fprintf (stderr, "%s: %s\n", argv[0], nbd_get_error ()); >> + exit (EXIT_FAILURE); >> + } >> + if ((nbd_aio_get_direction (nbd) & LIBNBD_AIO_DIRECTION_WRITE) == 0) { >> + fprintf (stderr, "%...
2019 Aug 13
0
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
...e commands. */ - cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, 0); + cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, + NULL, NULL, 0); if (cookies[0] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; } - cookies[1] = nbd_aio_pwrite (nbd, out, packetsize, packetsize, 0); + cookies[1] = nbd_aio_pwrite (nbd, out, packetsize, packetsize, NULL, NULL, 0); if (cookies[1] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; diff --git a/examples/glib-main-loop.c b/examples/glib-main-loop.c index 0...
2019 Aug 13
2
[PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
This applies on top of the OClosure v2 series posted a few minutes ago. Rich.
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...nds. */ cookies[0] = nbd_aio_pread (nbd, in, packetsize, 0, - NULL, NULL, 0); + NBD_NULL_CALLBACK(completion), 0); if (cookies[0] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; } - cookies[1] = nbd_aio_pwrite (nbd, out, packetsize, packetsize, NULL, NULL, 0); + cookies[1] = nbd_aio_pwrite (nbd, out, packetsize, packetsize, + NBD_NULL_CALLBACK(completion), 0); if (cookies[1] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; diff --git...
2019 May 31
0
[libnbd] Simultaneous read and write
...locks again). With my initial use of libnbd, the division of labor for which thread writes a packet falls into three classes: - if the state machine is ready, the libnbd fd is polling only on POLLIN; from there: - if the request is small, the entire request is written by the nbdkit thread during nbd_aio_pwrite (in this case, our write to the pipe-to-self is actually wasted work, because the reader loop thread will spuriously wake up, check the directions, and see that it still only needs POLLIN for the next server response) - if the request is large, the first half of the request is written from the n...
2019 May 31
4
[libnbd] Simultaneous read and write
This is a continuation of a discussion we were having on IRC. The problems with IRC are it's not recorded and it's hard to have deep technical conversations. I hope this is a decent summary. Problem simply stated: Certain NBD servers (qemu-nbd in particular) are able to simultaneously read and write on a socket. ie. They can be simultaneously reading a request and writing the reply to
2020 Sep 11
3
[libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...+ fprintf (stderr, "%s: test failed: nbd_kill_subprocess: %s\n", argv[0], + nbd_get_error ()); + exit (EXIT_FAILURE); + } + + /* Issue back-to-back write requests, both large enough to block. Set up + * the second to auto-retire via callback. + */ + if ((cookie = nbd_aio_pwrite (nbd, buf, sizeof buf, 0, + NBD_NULL_COMPLETION, 0)) == -1) { + fprintf (stderr, "%s: test failed: first nbd_aio_pwrite: %s\n", argv[0], + nbd_get_error ()); + exit (EXIT_FAILURE); + } + if (nbd_aio_pwrite (nbd, buf, sizeof buf, 0, +...
2023 May 30
2
[libnbd PATCH v3 04/22] states: Prepare to send 64-bit requests
...re behavior based on negotiated mode), passing the flag to pread works even when it would be technically wrong over the wire. The FIXME does get modified again later in the series, when I do add in support for detecting when the server supports extended headers. > > > + > > + if (nbd_aio_pwrite (nbd, buf, 512, 0, NBD_NULL_COMPLETION, > > + LIBNBD_CMD_FLAG_PAYLOAD_LEN) == -1) { > > + fprintf (stderr, "%s: %s\n", argv[0], nbd_get_error ()); > > + exit (EXIT_FAILURE); > > + } > > + > > + if (nbd_aio_pwrite (nbd, buf,...
2019 Jun 28
1
[libnbd PATCH] disconnect: Prevent any further commands
...ype) { /* Commands which send or receive data are limited to MAX_REQUEST_SIZE. */ case NBD_CMD_READ: diff --git a/tests/errors.c b/tests/errors.c index 415c378..faa1488 100644 --- a/tests/errors.c +++ b/tests/errors.c @@ -168,7 +168,7 @@ main (int argc, char *argv[]) check (ERANGE, "nbd_aio_pwrite: "); /* Queue up a write command so large that we block on POLLIN, then queue - * multiple disconnects. XXX The last one should fail. + * multiple disconnects. */ if (nbd_aio_pwrite (nbd, buf, 2 * 1024 * 1024, 0, 0) == -1) { fprintf (stderr, "%s: %s\n", argv[0],...
2020 Sep 17
0
Re: [libnbd PATCH] api: Add LIBNBD_SHUTDOWN_IMMEDIATE flag
...led: nbd_kill_subprocess: %s\n", argv[0], > + nbd_get_error ()); > + exit (EXIT_FAILURE); > + } > + > + /* Issue back-to-back write requests, both large enough to block. Set up > + * the second to auto-retire via callback. > + */ > + if ((cookie = nbd_aio_pwrite (nbd, buf, sizeof buf, 0, > + NBD_NULL_COMPLETION, 0)) == -1) { > + fprintf (stderr, "%s: test failed: first nbd_aio_pwrite: %s\n", argv[0], > + nbd_get_error ()); > + exit (EXIT_FAILURE); > + } > + if (nbd_aio_pwrite (...
2019 Aug 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function rather than libnbd-api.3 (nice), but in doing so got stumped by a problem with a fresh git clone (automake fails for any 'include' directive that does not already exist). I've figured out how to hack around it, but the hack requires GNU make. We already use GNU make constructs elsewhere (such as $(wildcard)), but
2019 Jul 03
1
[libnbd PATCH] tests: Make errors more robust under load
...inked later during atexit */ + perror ("close"); + exit (EXIT_FAILURE); + } + script_fd = -2; + nbd = nbd_create (); if (nbd == NULL) { fprintf (stderr, "%s\n", nbd_get_error ()); @@ -167,13 +227,29 @@ main (int argc, char *argv[]) } check (ERANGE, "nbd_aio_pwrite: "); - /* Queue up a write command so large that we block on POLLIN, then queue - * multiple disconnects. + /* Send a read that the nbdkit sh plugin will fail. */ + if (nbd_pread (nbd, buf, 512, 0, 0) != -1) { + fprintf (stderr, "%s: test failed: " + "nbd_p...
2019 Jun 04
0
[PATCH libnbd v2 1/4] examples, tests: Remove want_to_send / ready logic, increase limit on cmds in flight.
...*/ - want_to_send = - i > 0 && in_flight < MAX_IN_FLIGHT && nbd_aio_is_ready (nbd); + while (i > 0 && in_flight < MAX_IN_FLIGHT) { + offset = rand () % (exportsize - sizeof buf); + cmd = rand () & 1; + if (cmd == 0) + handle = nbd_aio_pwrite (nbd, buf, sizeof buf, offset, 0); + else + handle = nbd_aio_pread (nbd, buf, sizeof buf, offset, 0); + if (handle == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + goto error; + } + handles[in_flight] = handle; + i--; + in_flight...
2019 Jun 12
3
[libnbd PATCH 0/2] More with MSG_MORE
I'm not sure if this is worth pursuing. On paper, it makes sense (if we know we have multiple commands batched to send over the wire, AND those commands are short in length, we might as well use MSG_MORE), but the measurement numbers with it applied might just be in the noise. Eric Blake (2): examples: Enhance access patterns of threaded-reads-and-writes states: Another use for MSG_MORE
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...ished_read, .user_data = &buffers[i] }, > + 0) == -1) { > fprintf (stderr, "%s\n", nbd_get_error ()); > exit (EXIT_FAILURE); > } > @@ -428,7 +429,8 @@ write_data (gpointer user_data) > buffer->state = BUFFER_WRITING; > if (nbd_aio_pwrite (gsdest->nbd, buffer->data, > BUFFER_SIZE, buffer->offset, > - finished_write, buffer, 0) == -1) { > + (nbd_completion_callback) { .callback = finished_write, .user_data = buffer }, Worth splitting the long lines?...
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 Jun 29
0
[libnbd PATCH 1/6] api: Add nbd_aio_in_flight
.../* counts number of requests in flight */ int dir, r; /* Issue commands. */ - in_flight = 0; handles[0] = nbd_aio_pread (nbd, in, packetsize, 0, 0); if (handles[0] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; } - in_flight++; handles[1] = nbd_aio_pwrite (nbd, out, packetsize, packetsize, 0); if (handles[1] == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); goto error; } - in_flight++; /* Now wait for commands to retire, or for deadlock to occur */ - while (in_flight > 0) { + while (nbd_aio_in_flight (nbd) &gt...