linux/fs/fuse
David Howells 8cefc107ca pipe: Use head and tail pointers for the ring, not cursor and length
Convert pipes to use head and tail pointers for the buffer ring rather than
pointer and length as the latter requires two atomic ops to update (or a
combined op) whereas the former only requires one.

 (1) The head pointer is the point at which production occurs and points to
     the slot in which the next buffer will be placed.  This is equivalent
     to pipe->curbuf + pipe->nrbufs.

     The head pointer belongs to the write-side.

 (2) The tail pointer is the point at which consumption occurs.  It points
     to the next slot to be consumed.  This is equivalent to pipe->curbuf.

     The tail pointer belongs to the read-side.

 (3) head and tail are allowed to run to UINT_MAX and wrap naturally.  They
     are only masked off when the array is being accessed, e.g.:

	pipe->bufs[head & mask]

     This means that it is not necessary to have a dead slot in the ring as
     head == tail isn't ambiguous.

 (4) The ring is empty if "head == tail".

     A helper, pipe_empty(), is provided for this.

 (5) The occupancy of the ring is "head - tail".

     A helper, pipe_occupancy(), is provided for this.

 (6) The number of free slots in the ring is "pipe->ring_size - occupancy".

     A helper, pipe_space_for_user() is provided to indicate how many slots
     userspace may use.

 (7) The ring is full if "head - tail >= pipe->ring_size".

     A helper, pipe_full(), is provided for this.

Signed-off-by: David Howells <dhowells@redhat.com>
2019-10-31 15:12:34 +00:00
..
acl.c fuse: Support fuse filesystems outside of init_user_ns 2018-03-20 17:11:44 +01:00
control.c convenience helper: get_tree_single() 2019-07-04 22:01:58 -04:00
cuse.c fuse: fix memleak in cuse_channel_open 2019-09-24 15:28:01 +02:00
dev.c pipe: Use head and tail pointers for the ring, not cursor and length 2019-10-31 15:12:34 +00:00
dir.c fuse: kmemcg account fs data 2019-09-24 15:28:01 +02:00
file.c fuse: kmemcg account fs data 2019-09-24 15:28:01 +02:00
fuse_i.h virtio-fs: add virtiofs filesystem 2019-09-18 20:17:50 +02:00
inode.c add virtio-fs 2019-09-27 15:54:24 -07:00
Kconfig virtio-fs: add virtiofs filesystem 2019-09-18 20:17:50 +02:00
Makefile virtio-fs: add virtiofs filesystem 2019-09-18 20:17:50 +02:00
readdir.c fuse: fix beyond-end-of-page access in fuse_parse_cache() 2019-09-24 15:28:01 +02:00
virtio_fs.c virtio-fs: add virtiofs filesystem 2019-09-18 20:17:50 +02:00
xattr.c fuse: rearrange and resize fuse_args fields 2019-09-10 16:29:48 +02:00