aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org> 2022-08-03 13:59:15 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org> 2022-08-03 13:59:15 -0700
commitd9b58ab789b053b70dc475f1efda124857f10aa2 (patch)
treef43c705e4417e65811de57f38b5a85cc9e7812d9 /include/linux
parentMerge tag 'pull-work.iov_iter-base' of git://git.kernel.org/pub/scm/linux/ker... (diff)
parentfix short copy handling in copy_mc_pipe_to_iter() (diff)
downloadlinux-d9b58ab789b053b70dc475f1efda124857f10aa2.tar.gz
linux-d9b58ab789b053b70dc475f1efda124857f10aa2.tar.bz2
linux-d9b58ab789b053b70dc475f1efda124857f10aa2.zip
Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull copy_to_iter_mc fix from Al Viro: "Backportable fix for copy_to_iter_mc() - the second part of iov_iter work will pretty much overwrite this, but would be much harder to backport" * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fix short copy handling in copy_mc_pipe_to_iter()
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pipe_fs_i.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index cb0fd633a610..4ea496924106 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -229,6 +229,15 @@ static inline bool pipe_buf_try_steal(struct pipe_inode_info *pipe,
return buf->ops->try_steal(pipe, buf);
}
+static inline void pipe_discard_from(struct pipe_inode_info *pipe,
+ unsigned int old_head)
+{
+ unsigned int mask = pipe->ring_size - 1;
+
+ while (pipe->head > old_head)
+ pipe_buf_release(pipe, &pipe->bufs[--pipe->head & mask]);
+}
+
/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
#define PIPE_SIZE PAGE_SIZE