Re: what is the return value of:

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7-3-2020 19:13, Gregory Farnum wrote:
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.
Hi Greg,

Thanx for the info.

I can count what needs to be written from the elements in iov[]. So that I can fix
in my code. But if -ERRNO is returned could there be a partial write?

I tried to find something documentation on the client stuff in librados/rbd, but I could not find any other than testcode in  unittest_librbd. That gives an idea,
but intricate details are not in there.

--WjW
_______________________________________________
Dev mailing list -- dev@xxxxxxx
To unsubscribe send an email to dev-leave@xxxxxxx




[Index of Archives]     [CEPH Users]     [Ceph Devel]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux