Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1471501

[PATCH v2 1/8] pipe: relocate round_pipe_size() above pipe_set_size()

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!news.panservice.it!bofh.it!news.nic.it!robomod
From "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/8] pipe: relocate round_pipe_size() above pipe_set_size()
Date Mon, 29 Aug 2016 02:30:02 +0200
Message-ID <sbiCC-eG-45@gated-at.bofh.it> (permalink)
References <sbiCB-eG-9@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=nsUW3bzkyO6oe8D8WFckGU1fCCVx10Y6roCUo8da0ac=; b=BWAAzzjcrkFrz/W5EnL1tsYjUg/ixxNzBzXywW1EOhTlSASfxucYqy4nnWa5k51enD lYsrxeNkmemiQmWsHPfj5w8hqim86SM9hTYS7wU430XQI+Fa84ZQ/6X8DdzIcWqWzJjX 2MoEpaYH8Mvd0MnJX+9d+waCHnifSUdV+MUhX2SyOabh8xG+JBUbl9e2JOjTDb8cV19C yarjlNLe+aysjL5jNamEO/41D1MaWQqufkERGpzNIYQSR+9x2tDxN4hfaXoHejL1pwKG GzByBC4ldHSKGKbSauv0lEnQyqCPON1dgNfsKszk/HHa/vBtK37xcZf3bsuPw/KQHZ5F S5+A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=nsUW3bzkyO6oe8D8WFckGU1fCCVx10Y6roCUo8da0ac=; b=X9FHh4ugGn9WFM892JFqYLEkj52oqFet23Y4WA/JLFeeCqHTy3YF5iWSRYd+oHR3mK FZhTiEcbVssuHMPRX+j8H95rgkBmHoTjwdTqXAa6MWwiAm81FG7PKDCwJqi5YzMz4+hI KWpiMQJ9OhAB47iAqF5OOLHx9t9jRT/j7xZDFUVF2npt/NQQ/k+G0IFoszFQRjm0Xqac 2z7Fm+/rPx3EvzqejzWDUoWchlrHQqRTfOrWu/tUK24uSFo+beGcXLJ4+l+VgqEdw8ER 51EMuSYKgaAtZ8YfkxXo/6hbWso5/IvBwRfHMTU6VdM7Rowl5iuqmTpKECwxLiFjwTDA cvqQ==
X-Gm-Message-State AE9vXwNq5Q/X5cWts/rSLc7kkEOSxIN2OkjnYXtt+1Yo2AsRV3c5qWlRKevwp0W5gK7+lw==
X-Received by 10.66.138.108 with SMTP id qp12mr27279452pab.65.1472430064494; Sun, 28 Aug 2016 17:21:04 -0700 (PDT)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 61
Organization linux.* mail to news gateway
X-Original-Cc mtk.manpages@gmail.com, Willy Tarreau <w@1wt.eu>, Vegard Nossum <vegard.nossum@oracle.com>, socketpair@gmail.com, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>, Jens Axboe <axboe@fb.com>, Al Viro <viro@zeniv.linux.org.uk>, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Mon, 29 Aug 2016 12:20:57 +1200
X-Original-Message-ID <91a91fdb-a959-ba7f-b551-b62477cc98a1@gmail.com>
X-Original-References <ef9ce203-6683-31b1-26dc-e0b823aba73e@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1471501

Show key headers only | View raw


This is a minor preparatory patch. After subsequent patches,
round_pipe_size() will be called from pipe_set_size(), so place
round_pipe_size() above pipe_set_size().

Cc: Willy Tarreau <w@1wt.eu>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: socketpair@gmail.com
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Jens Axboe <axboe@fb.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-api@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
---
 fs/pipe.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/pipe.c b/fs/pipe.c
index 4ebe6b2..7d7c21e 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1011,6 +1011,18 @@ const struct file_operations pipefifo_fops = {
 };
 
 /*
+ * Currently we rely on the pipe array holding a power-of-2 number
+ * of pages.
+ */
+static inline unsigned int round_pipe_size(unsigned int size)
+{
+	unsigned long nr_pages;
+
+	nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+	return roundup_pow_of_two(nr_pages) << PAGE_SHIFT;
+}
+
+/*
  * Allocate a new array of pipe buffers and copy the info over. Returns the
  * pipe size if successful, or return -ERROR on error.
  */
@@ -1062,18 +1074,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages)
 }
 
 /*
- * Currently we rely on the pipe array holding a power-of-2 number
- * of pages.
- */
-static inline unsigned int round_pipe_size(unsigned int size)
-{
-	unsigned long nr_pages;
-
-	nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	return roundup_pow_of_two(nr_pages) << PAGE_SHIFT;
-}
-
-/*
  * This should work even if CONFIG_PROC_FS isn't set, as proc_dointvec_minmax
  * will return an error.
  */
-- 
2.5.5

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 1/8] pipe: relocate round_pipe_size() above pipe_set_size() "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-08-29 02:30 +0200

csiph-web