On Fri, Mar 6, 2020 at 8:04 AM Willem Jan Withagen <wjw@xxxxxxxxxxx> wrote: > > Hoi, > > When writting a Rados/Rbd client I noticed that the sequence: > > r = rbd_aio_readv(ri->ri_image, iov, iovcnt, offset, comp); > r = rbd_aio_wait_for_complete(comp); > nbytes = rbd_aio_get_return_value(comp); > > returns the number of bytes read in nbytes. > > Now if I do the same but with `rbd_aio_write(v)` I only receive > zero as value... > > I would have expected that rbd_aio_get_return_value would more > or less function like aio_return(2): > DESCRIPTION > The aio_return() system call returns the final status of the > asynchronous > I/O request associated with the structure pointed to by iocb. > RETURN VALUES > If the asynchronous I/O request has completed, the status is > returned as > described in read(2), write(2), or fsync(2). Otherwise, aio_return() > returns -1 and sets errno to indicate the error condition. > > So I was expecting the amount of bytes written? Understandable, but for "distributed systems are hard" reasons, writes return either 0 (success) or -ERRNO. [1] I guess librbd could translate that back into the given write size, but it's never come up as an issue and might have some weird edge cases? -Greg [1]: Returning anything else requires recording the return value as an additional write, or part of the write, so that we give out the same answer on replay of the write request. We've been talking for years about extending the protocol+implementation to allow sending back 32 or 64 bytes of data from a write, and...I can't recall if one of those times it finally got done. > > --WjW > > _______________________________________________ > Dev mailing list -- dev@xxxxxxx > To unsubscribe send an email to dev-leave@xxxxxxx _______________________________________________ Dev mailing list -- dev@xxxxxxx To unsubscribe send an email to dev-leave@xxxxxxx