Displaying 8 results from an estimated 8 matches for "nbd_set_concurrent_writer".
2019 Jun 04
0
[PATCH libnbd v2 3/4] api: Implement concurrent writer.
...time on the same socket from different threads.
+
+There is a full example using a concurrent writer available at
+L<https://github.com/libguestfs/libnbd/blob/master/examples/concurrent-writer.c>
+
+To implement this, you change your ordinary AIO code in four ways:
+
+=over 4
+
+=item 1. Call nbd_set_concurrent_writer
+
+ struct writer_data {
+ struct nbd_handle *nbd;
+ /* other data here as required */
+ } data;
+
+ nbd_set_concurrent_writer (nbd, &data, writer);
+
+This function can be called on the handle at any time, either after
+the handle is created or after the connection and handshaking has
+co...
2019 Jun 03
1
Re: [PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...;
> +
> +There is a full example using a concurrent writer available at
> +L<https://github.com/libguestfs/libnbd/blob/master/examples/concurrent-writer.c>
> +
> +To implement this, you change your ordinary AIO code in four ways:
> +
> +=over 4
> +
> +=item 1. Call nbd_set_concurrent_writer
> +
> + struct writer_data {
> + struct nbd_handle *nbd;
> + /* other data here as required */
> + } data;
> +
> + nbd_set_concurrent_writer (nbd, &data, writer);
> +
> +This function can be called on the handle at any time, either after
> +the handle is creat...
2019 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...e
+running at the same time on the same socket.
+
+There is a full example using a concurrent writer available at
+L<https://github.com/libguestfs/libnbd/blob/master/examples/concurrent-writer.c>
+
+To implement this, you change your ordinary AIO code in four ways:
+
+=over 4
+
+=item 1. Call nbd_set_concurrent_writer
+
+ struct writer_data {
+ struct nbd_handle *nbd;
+ /* other data here as required */
+ } data;
+
+ nbd_set_concurrent_writer (nbd, &data, writer);
+
+This function can be called on the handle at any time, either after
+the handle is created or after the connection and handshaking has
+co...
2019 Jun 03
10
[PATCH libnbd discussion only 0/5] api: Implement concurrent writer.
This works, but there's no time saving and I'm still investigating
whether it does what I think it does. Nevertheless I thought I would
post it because it (probably) implements the idea I had last night
outlined in:
https://www.redhat.com/archives/libguestfs/2019-June/msg00010.html
The meat of the change is patch 4. Patch 5 is an example which I
would probably fold into patch 4 for
2019 Jun 04
9
[PATCH libnbd v2 0/4] api: Implement concurrent writer.
v1:
https://www.redhat.com/archives/libguestfs/2019-June/msg00014.html
I pushed a few bits which are uncontroversial. The main
changes since v1 are:
An extra patch removes the want_to_send / check for nbd_aio_is_ready
in examples/threaded-reads-and-writes.c. This logic was wrong since
commit 6af72b87 as was pointed out by Eric in his review. Comments
and structure of
2019 Jun 04
0
[PATCH libnbd v2 4/4] examples: Add concurrent writer example.
...= NULL;
+ pthread_mutex_init (&writer_data.q_lock, NULL);
+
+ err = pthread_create (&writer_thread, NULL,
+ start_writer_thread, &writer_data);
+ if (err != 0) {
+ errno = err;
+ perror ("pthread_create");
+ exit (EXIT_FAILURE);
+ }
+
+ if (nbd_set_concurrent_writer (nbd, &writer_data, writer) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+
+ /* Issue commands. */
+ in_flight = 0;
+ i = NR_CYCLES;
+ while (i > 0 || in_flight > 0) {
+ if (nbd_aio_is_dead (nbd) || nbd_aio_is_closed (nbd)) {
+...
2019 Jun 03
0
[PATCH libnbd discussion only 5/5] examples: Add concurrent writer example.
...= NULL;
+ pthread_mutex_init (&writer_data.q_lock, NULL);
+
+ err = pthread_create (&writer_thread, NULL,
+ start_writer_thread, &writer_data);
+ if (err != 0) {
+ errno = err;
+ perror ("pthread_create");
+ exit (EXIT_FAILURE);
+ }
+
+ if (nbd_set_concurrent_writer (nbd, &writer_data, writer) == -1) {
+ fprintf (stderr, "%s\n", nbd_get_error ());
+ exit (EXIT_FAILURE);
+ }
+
+ /* Issue commands. */
+ in_flight = 0;
+ i = NR_CYCLES;
+ while (i > 0 || in_flight > 0) {
+ if (nbd_aio_is_dead (nbd) || nbd_aio_is_closed (nbd)) {
+...
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