linux/fs/fuse
Linus Torvalds 00a7d39898 fs/pipe: add simpler helpers for common cases
The fix to atomically read the pipe head and tail state when not holding
the pipe mutex has caused a number of headaches due to the size change
of the involved types.

It turns out that we don't have _that_ many places that access these
fields directly and were affected, but we have more than we strictly
should have, because our low-level helper functions have been designed
to have intimate knowledge of how the pipes work.

And as a result, that random noise of direct 'pipe->head' and
'pipe->tail' accesses makes it harder to pinpoint any actual potential
problem spots remaining.

For example, we didn't have a "is the pipe full" helper function, but
instead had a "given these pipe buffer indexes and this pipe size, is
the pipe full".  That's because some low-level pipe code does actually
want that much more complicated interface.

But most other places literally just want a "is the pipe full" helper,
and not having it meant that those places ended up being unnecessarily
much too aware of this all.

It would have been much better if only the very core pipe code that
cared had been the one aware of this all.

So let's fix it - better late than never.  This just introduces the
trivial wrappers for "is this pipe full or empty" and to get how many
pipe buffers are used, so that instead of writing

        if (pipe_full(pipe->head, pipe->tail, pipe->max_usage))

the places that literally just want to know if a pipe is full can just
say

        if (pipe_is_full(pipe))

instead.  The existing trivial cases were converted with a 'sed' script.

This cuts down on the places that access pipe->head and pipe->tail
directly outside of the pipe code (and core splice code) quite a lot.

The splice code in particular still revels in doing the direct low-level
accesses, and the fuse fuse_dev_splice_write() code also seems a bit
unnecessarily eager to go very low-level, but it's at least a bit better
than it used to be.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2025-03-06 18:25:35 -10:00
..
acl.c fuse: support idmapped ->set_acl 2024-09-04 16:51:11 +02:00
control.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
cuse.c fuse: remove pages for requests and exclusively use folios 2024-11-05 14:08:35 +01:00
dax.c fuse: make args->in_args[0] to be always the header 2025-01-24 11:54:02 +01:00
dev.c fs/pipe: add simpler helpers for common cases 2025-03-06 18:25:35 -10:00
dev_uring.c fuse: prevent disabling io-uring on active connections 2025-01-27 18:02:23 +01:00
dev_uring_i.h fuse: {io-uring} Prevent mount point hang on fuse-server termination 2025-01-27 18:02:21 +01:00
dir.c fuse: don't truncate cached, mutated symlink 2025-02-20 15:48:17 +01:00
file.c fuse: revert back to __readahead_folio() for readahead 2025-02-14 10:49:23 +01:00
fuse_dev_i.h fuse: {io-uring} Make fuse_dev_queue_{interrupt,forget} non-static 2025-01-27 18:01:22 +01:00
fuse_i.h fuse: block request allocation until io-uring init is complete 2025-01-27 18:02:23 +01:00
fuse_trace.h fuse: add simple request tracepoints 2024-08-29 11:43:13 +02:00
inode.c fuse: block request allocation until io-uring init is complete 2025-01-27 18:02:23 +01:00
ioctl.c fuse: remove pages for requests and exclusively use folios 2024-11-05 14:08:35 +01:00
iomode.c fuse: fix parallel dio write on file open in passthrough mode 2024-04-15 10:12:44 +02:00
Kconfig fuse: {io-uring} Handle SQEs - register commands 2025-01-24 11:54:08 +01:00
Makefile fuse: {io-uring} Handle SQEs - register commands 2025-01-24 11:54:08 +01:00
passthrough.c backing-file: clean up the API 2024-11-11 10:45:03 +01:00
readdir.c fuse: check attributes staleness on fuse_iget() 2024-11-18 12:24:13 +01:00
sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
virtio_fs.c virtio: features, fixes, cleanups 2024-11-27 13:11:58 -08:00
xattr.c fuse: make args->in_args[0] to be always the header 2025-01-24 11:54:02 +01:00