search for: aio_pread

Displaying 20 results from an estimated 58 matches for "aio_pread".

Did you mean: aio_pthread
2019 Aug 11
3
[PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
...gramming languages. +As such it is B<not> covered by the usual API stability +guarantee offered by other parts of the C API. Use it with care. + +Some pointers passed to libnbd calls are saved in the +S<C<struct nbd_handle>>. These include pointers to buffers +passed to C<nbd_aio_pread>, C<nbd_aio_pwrite>, etc., +and pointers to the C<user_data> for callbacks. If you +want to know when it is safe to free these objects then +you can register a free callback using: + + typedef void (*nbd_free_callback) (void *ptr); + int nbd_add_free_callback (struct nbd_handle *h,...
2019 Aug 12
2
Re: [PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...*callback; }; struct closure_wrap *wrap = malloc (sizeof *wrap); wrap->buf = malloc (sizeof (*wrap->buf)); caml_register_generational_global_root (wrap->buf); struct nbd_buffer *buf_buf = NBD_buffer_val (bufv); const void *buf = buf_buf->data; size_t count = buf_buf->len; if (in nbd_aio_pread) { wrap->callback = NULL; res = nbd_aio_pread_callback(h, buf, count, offset, NULL, free_cb, wrap, flags); } else /* in nbd_aio_pread_callback */ { wrap->callback = ...; res = nbd_aio_pread_callback(h, buf, count, offset,...
2019 Aug 26
2
Re: [PATCH disk-sync 5/5] Convert disk_sync inner loop to asynchronous.
...) > >diff --git a/wrapper/disk_sync.py b/wrapper/disk_sync.py >index e655ead..e854009 100644 >--- a/wrapper/disk_sync.py >+++ b/wrapper/disk_sync.py >@@ -409,6 +409,26 @@ def get_block_status(nbd_handle, extent): > return blocks > > >+# This is called back when nbd_aio_pread completes. >+def read_completed(fd, buf, offset, err): >+ logging.debug('Writing %d B to offset %d B' % (buf.size(), offset)) >+ os.pwrite(fd, buf.to_bytearray(), offset) >+ # By returning 1 here we auto-retire the aio_pread command. >+ return 1 >+ >+ >+#...
2019 Aug 13
1
Re: [PATCH libnbd] api: Rename nbd_aio_*_callback to nbd_aio_*.
..._aio_* > > (2) Any existing call to nbd_aio_* must have two extra NULL parameters > added before the final flags parameter. > > In non-C languages, only change (1) is required. It is still possible to compile for 0.9.6 and this patch simultaneously, by checking LIBNBD_HAVE_NBD_AIO_PREAD_CALLBACK as a witness of which API style to use (although it's also just as easy to bump minimum version requirements to 0.9.7, once we have a release including this and any other API changes being discussed...). > +++ b/docs/libnbd.pod > @@ -276,9 +276,8 @@ command has completed: >...
2019 May 28
0
[PATCH] api: Add a special type for the flags argument.
..."nr_entries")]); - UInt32 "flags" ]; + Flags "flags" ]; ret = RErr; shortdesc = "read the block status of the given range"; longdesc = "\ @@ -1483,7 +1484,7 @@ on the connection."; "aio_pread", { default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; - UInt32 "flags" ]; + Flags "flags" ]; ret = RInt64; shortdesc = "read from the NBD server"; longdesc =...
2019 Aug 22
7
[PATCH disk-sync 0/5] Misc cleanups and convert inner loop to asynch.
...so it's for discussion only.) Patch 5 converts the inner loop to use asynchronous libnbd calls. performance improves quite a bit for me -- about 13 minutes down to 5 minutes for an "initial" run on a moderate sized Linux VM. We do this by changing the read call from nbd.pread to nbd.aio_pread and moving the writing code into a completion callback which runs when the NBD_CMD_READ has been executed by nbdkit. The problem with this patch, which is why I say it's for discussion only, is that we need to change it to throttle the number of commands in flight. Issuing large numbers of co...
2019 Aug 10
0
[PATCH libnbd 1/5] python: Change aio_buffer into nbd.Buffer class.
...e" ] @ List.map fst handle_calls); pr " { NULL, NULL, 0, NULL }\n"; pr "};\n"; pr "\n"; @@ -4502,17 +4506,28 @@ Error.__str__ = _str pr "\ -# AIO buffer functions. -def aio_buffer (len): - '''allocate an AIO buffer used for nbd.aio_pread and nbd.aio_pwrite''' - return libnbdmod.alloc_aio_buffer (len) - -def aio_buffer_from_bytearray (ba): - '''create an AIO buffer from a bytearray''' - return libnbdmod.aio_buffer_from_bytearray (ba) -def aio_buffer_to_bytearray (buf): - '''...
2019 Aug 10
7
[PATCH libnbd 0/5] WIP: python: Add test for doing asynch copy.
This doesn't yet work. However it does make me more convinced than ever that we really need to sort out persistent buffer lifetimes in the library (similar to what we did for closures). Rich.
2019 May 28
2
[PATCH] api: Add a special type for the flags argument.
This applies on top of patches 1 & 2 here (instead of patch 3): https://www.redhat.com/archives/libguestfs/2019-May/msg00206.html https://www.redhat.com/archives/libguestfs/2019-May/msg00207.html Rich.
2019 Aug 12
0
Re: [PATCH libnbd proposal] api: Add semi-private function for freeing persistent data.
...any free callbacks to use? How does that scale, if the user can register an arbitrary number of pointers because they queue up a large number of requests before starting the poll loop? Is the existing idea of a VALID|FREE parameter not sufficient? If we can convince the C bindings for python nbd.aio_pread to increase the refcount of buf, and then install a C completion handler (whether the python user called nbd.aio_pread with no python completer, or whether they called nbd.aio_pread_complete) that does the decref when called with FREE, then that would do the same job, even without the need for nbd_...
2019 Aug 22
0
[PATCH disk-sync 5/5] Convert disk_sync inner loop to asynchronous.
...nged, 39 insertions(+), 16 deletions(-) diff --git a/wrapper/disk_sync.py b/wrapper/disk_sync.py index e655ead..e854009 100644 --- a/wrapper/disk_sync.py +++ b/wrapper/disk_sync.py @@ -409,6 +409,26 @@ def get_block_status(nbd_handle, extent): return blocks +# This is called back when nbd_aio_pread completes. +def read_completed(fd, buf, offset, err): + logging.debug('Writing %d B to offset %d B' % (buf.size(), offset)) + os.pwrite(fd, buf.to_bytearray(), offset) + # By returning 1 here we auto-retire the aio_pread command. + return 1 + + +# Process any AIO requests withou...
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...91,10 @@ required into the server's replies, or if you want to use C<LIBNBD_CMD_FLAG_DF>. The C<flags> parameter must be C<0> for now (it exists for future NBD -protocol extensions)."; +protocol extensions)." +^ strict_call_description; see_also = [Link "aio_pread"; Link "pread_structured"; - Link "get_block_size"]; + Link "get_block_size"; Link "set_strict_mode"]; example = Some "examples/fetch-first-sector.c"; }; @@ -1646,9 +1670,11 @@ The C<flags> parameter...
2019 May 28
6
[RFC libnbd PATCH 0/4] Add CMD_FLAG_DF support
RFC because this is an API break, but we haven't declared stable API yet. If we like it, I'm working on using libnbd to implement the nbdkit-nbd plugin; knowing whether it is API version 0.1 or 0.2 will be useful. I also dabbled with allowing optional parameters in python, although my OCaml is weak enough that there may be cleaner ways to approach that. Eric Blake (4): api: Add flags
2019 Aug 13
1
Re: [PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
On Mon, Aug 12, 2019 at 11:00:01PM +0100, Richard W.M. Jones wrote: > On Mon, Aug 12, 2019 at 01:53:56PM -0500, Eric Blake wrote: > > We then have the design question of whether to make an OClosure type, > > where C has two functions nbd_aio_pread and nbd_aio_pread_callback for > > convenience, but where other languages have only a single nbd.aio_pread > > where the callback parameter is optional (the Closure type for > > pread_structured chunk and for block_status extent will still be > > mandatory; it is only the co...
2019 Aug 27
0
Re: [PATCH disk-sync 5/5] Convert disk_sync inner loop to asynchronous.
...nc.py b/wrapper/disk_sync.py > >index e655ead..e854009 100644 > >--- a/wrapper/disk_sync.py > >+++ b/wrapper/disk_sync.py > >@@ -409,6 +409,26 @@ def get_block_status(nbd_handle, extent): > > return blocks > > > > > >+# This is called back when nbd_aio_pread completes. > >+def read_completed(fd, buf, offset, err): > >+ logging.debug('Writing %d B to offset %d B' % (buf.size(), offset)) > >+ os.pwrite(fd, buf.to_bytearray(), offset) > >+ # By returning 1 here we auto-retire the aio_pread command. > >+ re...
2019 Aug 11
4
[PATCH libnbd v2 0/3] python: Add test for doing asynch copy.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-August/msg00103.html In v2 I've made several changes: - Fix Python callbacks so if they don't return something which is int-like, we assume they mean to return 0. - Add nbd.Buffer free() method. Read commit message in patch 2 to see what this is about. - Fixed the asynch copy test to deal with the unbelievably
2019 Jul 25
2
[PATCH libnbd] lib: Kill subprocess in nbd_close.
This is a simple patch which stops nbd_close from waiting too long for a server subprocess to shut down. I wanted to send SIGHUP because the server will be able to catch it and do a clean shutdown if that is required. Is another signal better? Is it right to send a signal here? Rich.
2019 May 21
0
[libnbd] tmp patch adding deadlock test
.../* counts number of requests in flight */ + int dir, r, cmd; + bool want_to_send; + + /* The single thread "owns" the connection. */ + nbd_set_debug (nbd, true); + conn = nbd_get_connection (nbd, 0); + + /* Issue commands. */ + in_flight = 0; + fprintf (stderr, " * before aio_pread\n"); + handles[0] = nbd_aio_pread (conn, in, packetsize, 0); + if (handles[0] == -1) { + fprintf (stderr, "%s\n", nbd_get_error ()); + goto error; + } + fprintf (stderr, " * after aio_pread\n"); + in_flight++; + fprintf (stderr, " * before aio_pwrite\n&quot...
2019 Aug 12
2
Re: [PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...uch it is B<not> covered by the usual API stability > +guarantee offered by other parts of the C API. Use it with care. > + > +Some pointers passed to libnbd calls are saved in the > +S<C<struct nbd_handle>>. These include pointers to buffers > +passed to C<nbd_aio_pread>, C<nbd_aio_pwrite>, etc., > +and pointers to the C<user_data> for callbacks. If you > +want to know when it is safe to free these objects then > +you can register a free callback using: > + > + typedef void (*nbd_free_callback) (void *ptr, void *user_data); > + in...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...39;s replies, or if you want to use > C<LIBNBD_CMD_FLAG_DF>. > > The C<flags> parameter must be C<0> for now (it exists for future NBD > -protocol extensions)."; > +protocol extensions)." > +^ strict_call_description; > see_also = [Link "aio_pread"; Link "pread_structured"; > - Link "get_block_size"]; > + Link "get_block_size"; Link "set_strict_mode"]; > example = Some "examples/fetch-first-sector.c"; > }; > > @@ -1646,9 +1670,11 @...