]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pipe: add pipe_buf_get() helper
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 25 Feb 2020 20:16:13 +0000 (01:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2020 06:51:15 +0000 (07:51 +0100)
commit 7bf2d1df80822ec056363627e2014990f068f7aa upstream.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ajay Kaher <akaher@vmware.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/fuse/dev.c
fs/splice.c
include/linux/pipe_fs_i.h

index f5d2d2340b44d743b6aaca38c3b8e71f9945b425..36a5df92eb9c5b7f55da6c25e5d317e7d6d9a41e 100644 (file)
@@ -2052,7 +2052,7 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
                        pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1);
                        pipe->nrbufs--;
                } else {
-                       ibuf->ops->get(pipe, ibuf);
+                       pipe_buf_get(pipe, ibuf);
                        *obuf = *ibuf;
                        obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
                        obuf->len = rem;
index 8398974e15380dbeb8a93e56f81c69614e798323..fde126369966f8db171c84093ea8102fa2e988d5 100644 (file)
@@ -1876,7 +1876,7 @@ retry:
                         * Get a reference to this pipe buffer,
                         * so we can copy the contents over.
                         */
-                       ibuf->ops->get(ipipe, ibuf);
+                       pipe_buf_get(ipipe, ibuf);
                        *obuf = *ibuf;
 
                        /*
@@ -1948,7 +1948,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
                 * Get a reference to this pipe buffer,
                 * so we can copy the contents over.
                 */
-               ibuf->ops->get(ipipe, ibuf);
+               pipe_buf_get(ipipe, ibuf);
 
                obuf = opipe->bufs + nbuf;
                *obuf = *ibuf;
index 24f5470d394460c779ebdbd385d8f14766f14001..10876f3cb3da4f6b1751c528de314f9ab3b79503 100644 (file)
@@ -115,6 +115,17 @@ struct pipe_buf_operations {
        void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
 };
 
+/**
+ * pipe_buf_get - get a reference to a pipe_buffer
+ * @pipe:      the pipe that the buffer belongs to
+ * @buf:       the buffer to get a reference to
+ */
+static inline void pipe_buf_get(struct pipe_inode_info *pipe,
+                               struct pipe_buffer *buf)
+{
+       buf->ops->get(pipe, buf);
+}
+
 /* 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