Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2225876ybx; Fri, 8 Nov 2019 01:41:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyeADPeCTlekhyxikecbalhcthfg9BuODCk7LU7kdM9zI/YX3XSzHKDiNLP8N92vsG0km39 X-Received: by 2002:a17:906:5044:: with SMTP id e4mr7869909ejk.27.1573206083852; Fri, 08 Nov 2019 01:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573206083; cv=none; d=google.com; s=arc-20160816; b=n7ton/jrXL9easASHbVO6sDBU1hHvOUfEnP1Lh9ETiMTX4xvTa3d2q0PHxJ6+Vsm47 5iTvi1i8DjBGrXK1KlTsnrW62AeNP1Ue71fCYz3A0hzesejmroo0xea6aQLrpysEg8L1 aBj/q1QkBxP1xDJUe9JauXCuBaMv+j0+1o3XdAnwkpTbcJvNMih9MvT9ZOPwE2ul4i3X v/j425C1ZiFECE04SsPF7QWb/bu7mlF417UFTNV06NN9+p2VxHGSMuGVFdeCGy1c/W7A JRfFyEnReSWMqJEqtVq82fAaNcJUPYmM7sEthDtgcFK9zLs7jclKGVBHyLVCbpHaJTR1 qF2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=H4bybs4F2tikxrYYe4/P1QWGqo8QKHvHGtVtlmUlDzY=; b=qsMh3y9EU9kU0t9Z8izitTZOFz/0oS2SEWv0JN90c7htLXoyGuxpoG206hoSijLNcu RSfepF12/IwcPEgff/w3spfptBrGQlvGbEp/y2eRTMnwiio6oCT/oXeCRNLJ5OVuADqN pegGzfTm0idsojc0deRDffV5IOA3Q5KOjIh1IlmWk4ujdxFPEaVYfOuYq70pC/9VMurE Xr10hLpLIW0pjzCOn+9dQXn3M54tcHoRuh3OZUKH3Ui2t2ZgOgy4vEsA2XtyD+p+LLUd V8932ojAMtkccUQsZTxf8WpMOARYW8SbYXYz9Owvg0wD9PZaedBxSXVKIJTnkE2IC45j aI3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w56si3742207eda.376.2019.11.08.01.41.00; Fri, 08 Nov 2019 01:41:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731590AbfKHJib (ORCPT + 99 others); Fri, 8 Nov 2019 04:38:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:39774 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731447AbfKHJi2 (ORCPT ); Fri, 8 Nov 2019 04:38:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B2AA8AE68; Fri, 8 Nov 2019 09:38:24 +0000 (UTC) From: Vlastimil Babka To: stable@vger.kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ajay Kaher , Miklos Szeredi , Al Viro , Vlastimil Babka Subject: [PATCH STABLE 4.4 6/8] pipe: add pipe_buf_get() helper Date: Fri, 8 Nov 2019 10:38:12 +0100 Message-Id: <20191108093814.16032-7-vbabka@suse.cz> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191108093814.16032-1-vbabka@suse.cz> References: <20191108093814.16032-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi commit 7bf2d1df80822ec056363627e2014990f068f7aa upstream. Signed-off-by: Miklos Szeredi Signed-off-by: Al Viro Signed-off-by: Vlastimil Babka --- fs/fuse/dev.c | 2 +- fs/splice.c | 4 ++-- include/linux/pipe_fs_i.h | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f5d2d2340b44..36a5df92eb9c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -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; diff --git a/fs/splice.c b/fs/splice.c index 8398974e1538..fde126369966 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1876,7 +1876,7 @@ static int splice_pipe_to_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 = *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; diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 24f5470d3944..10876f3cb3da 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -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 -- 2.23.0