vfs_glusterfs changes to get rid of mutex use.
jra at samba.org
Wed Jan 21 17:21:42 MST 2015
On Wed, Jan 21, 2015 at 06:31:06PM -0500, Ira Cooper wrote:
> In my reading:
> write(2) is guaranteed to be atomic as long as you keep it under
> _POSIX_PIPE_BUF in size, which is defined to be at least 512 bytes. If you
> have pointers that large... I really want to know the architecture ;).
> (Note: If write is NOT atomic, this patch fails TOTALLY.)
> Because write(2) is guaranteed atomic, if you read the read(2) man page:
> "Upon successful completion, where nbyte is greater than 0, read() will
> mark for update the st_atime field of the file, and return the number of
> bytes read. This number will never be greater than nbyte. The value
> returned may be less than nbyte if the number of bytes left in the file is
> less than nbyte, if the read() request was interrupted by a signal, or if
> the file is a pipe or FIFO or special file and has fewer than nbyte bytes
> immediately available for reading. For example, a read() from a file
> associated with a terminal may return one typed line of data."
> The write being atomic, guarantees a proper size hunk of data always
> arrives, thus the read can't be partial. It will always have a pointer of
> data made available to it.
> I'd rather not make the code any more complicated than needed ;). I even
> considered not wrapping read/write to make the point that the guarantees
> these functions provide in this case is critical to success.
> All of this said, I'll be submitting a nice patch adding documentation to
> the calls, explaining the guarantees, and why using sys_read/sys_write is
> correct ;).
All right, I'll buy that for a dollar ! :-).
Thanks for adding the documentation explaining
the call, much appreciated !
More information about the samba-technical