Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[cascardo/linux.git] / fs / pipe.c
index 5c7c8b7..1f559f0 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -267,7 +267,6 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
                if (bufs) {
                        int curbuf = pipe->curbuf;
                        struct pipe_buffer *buf = pipe->bufs + curbuf;
                if (bufs) {
                        int curbuf = pipe->curbuf;
                        struct pipe_buffer *buf = pipe->bufs + curbuf;
-                       const struct pipe_buf_operations *ops = buf->ops;
                        size_t chars = buf->len;
                        size_t written;
                        int error;
                        size_t chars = buf->len;
                        size_t written;
                        int error;
@@ -275,7 +274,7 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
                        if (chars > total_len)
                                chars = total_len;
 
                        if (chars > total_len)
                                chars = total_len;
 
-                       error = ops->confirm(pipe, buf);
+                       error = pipe_buf_confirm(pipe, buf);
                        if (error) {
                                if (!ret)
                                        ret = error;
                        if (error) {
                                if (!ret)
                                        ret = error;
@@ -299,8 +298,7 @@ pipe_read(struct kiocb *iocb, struct iov_iter *to)
                        }
 
                        if (!buf->len) {
                        }
 
                        if (!buf->len) {
-                               buf->ops = NULL;
-                               ops->release(pipe, buf);
+                               pipe_buf_release(pipe, buf);
                                curbuf = (curbuf + 1) & (pipe->buffers - 1);
                                pipe->curbuf = curbuf;
                                pipe->nrbufs = --bufs;
                                curbuf = (curbuf + 1) & (pipe->buffers - 1);
                                pipe->curbuf = curbuf;
                                pipe->nrbufs = --bufs;
@@ -383,11 +381,10 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
                int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) &
                                                        (pipe->buffers - 1);
                struct pipe_buffer *buf = pipe->bufs + lastbuf;
                int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) &
                                                        (pipe->buffers - 1);
                struct pipe_buffer *buf = pipe->bufs + lastbuf;
-               const struct pipe_buf_operations *ops = buf->ops;
                int offset = buf->offset + buf->len;
 
                int offset = buf->offset + buf->len;
 
-               if (ops->can_merge && offset + chars <= PAGE_SIZE) {
-                       ret = ops->confirm(pipe, buf);
+               if (buf->ops->can_merge && offset + chars <= PAGE_SIZE) {
+                       ret = pipe_buf_confirm(pipe, buf);
                        if (ret)
                                goto out;
 
                        if (ret)
                                goto out;
 
@@ -664,7 +661,7 @@ void free_pipe_info(struct pipe_inode_info *pipe)
        for (i = 0; i < pipe->buffers; i++) {
                struct pipe_buffer *buf = pipe->bufs + i;
                if (buf->ops)
        for (i = 0; i < pipe->buffers; i++) {
                struct pipe_buffer *buf = pipe->bufs + i;
                if (buf->ops)
-                       buf->ops->release(pipe, buf);
+                       pipe_buf_release(pipe, buf);
        }
        if (pipe->tmp_page)
                __free_page(pipe->tmp_page);
        }
        if (pipe->tmp_page)
                __free_page(pipe->tmp_page);