Received: by 10.223.176.46 with SMTP id f43csp3332774wra; Mon, 22 Jan 2018 12:16:40 -0800 (PST) X-Google-Smtp-Source: AH8x227jX3pqvj8tHf08p8TtsESHr7quQ46XD1OtMZx0/nrYdYj9evqVv5AUjs4nBI3/Sj8fpehZ X-Received: by 10.202.97.4 with SMTP id v4mr4977961oib.104.1516652200440; Mon, 22 Jan 2018 12:16:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516652200; cv=none; d=google.com; s=arc-20160816; b=rnDpqaN5DVNqVBP0x+6Srjd/AQ1GkblMvhODnME8ILZ6gNP8kITURRVoCBOU1snroK Rj1edc3I0ieRSgDhNce5JSv7uBAhdHef7LVaIf7qop0T2ZyU9GBTttKPYToIfF08gD3m AEB5AcGsZ9sbBHdlWxNNTRx3V5JE5rhmivdWbSW70HS3XjrRavf2tHIf+bniCh3rndv8 RVklAkrbt5JRbz6/BiTabZUMIbDUuWmyp8W51SVD7NmbphwoUtxVR7YurgJK2P/0n0dW UFvbSQEs2GK0Qq/ge263Do3BdV8HOYul5MMUiIqwMMWGgq3pOvRd60823wi6aXs8GQDF XUbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5V68AXrXRpmVtaAmUJUSzHlaonmcbVJTSMuDtaHUI38=; b=odoImZGcDcYlzCTXbgM9gnNAu+7GESgvtcS2LmF8fBJY5piSTEHjFY/IRZOzk+bb0p pcvPzkDrkRohKXPq2WAOgPsZeztWDcdenD1RA5VH2lMsbWrR5rMT7dy1YOfRPL2kvzOV 9Yh82Nh+vmhXf/5zT+dHfoh+qSTeXvU1X5lsxc+Jym25YVqsHmXxOrxcVL+DZvzpgeiL Sf2nJjs5PFVwC9WSmEFvPXOGDI/N7igr0qD02ic/3yyz6k9fcjF6UvjV6oWGnpH87DYI HFl161io3e5t4znN917WjI1+WSvO0al4IzGBVDGIko753Y3OwgV1/4FCSp+znAGO3u8k Slcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=L7rlk1q2; 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 k6si5970698ioc.338.2018.01.22.12.16.27; Mon, 22 Jan 2018 12:16:40 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=L7rlk1q2; 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 S1751542AbeAVUOi (ORCPT + 99 others); Mon, 22 Jan 2018 15:14:38 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:49219 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963AbeAVUOf (ORCPT ); Mon, 22 Jan 2018 15:14:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5V68AXrXRpmVtaAmUJUSzHlaonmcbVJTSMuDtaHUI38=; b=L7rlk1q2RS2DXJeN4g4Zc7fJ6 9dY+BxcDGyaRyKufCh2vIX/GDxxJl+8WYBAf4J+Yy2UX4cMOebBpl2HfoSVsR4ScafsuMDO3Qf56H +509sGVGW89ys0xhBgt5tthGROid9UWugpY5/dKnuCMRmtTQSW07RJD+hDj167t2RlqBMRu2iMuZ3 m/DETx01v6WI1CvpTtOTyVE9dnv/0QJmrJZtassScV9zHS4POkLMdpIIzasNV55inLn+u9Mmzs4zb X+ExX1suBr4WcUJjwbs8kP7PLdA8RY+idST8PvCXxbuuHfBvOoGASIgq4evMVXXXOoNAM2d3P0mET MlG/Pu09A==; Received: from 178.114.226.247.wireless.dyn.drei.com ([178.114.226.247] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ediUD-0007yt-1b; Mon, 22 Jan 2018 20:14:33 +0000 From: Christoph Hellwig To: viro@zeniv.linux.org.uk Cc: Avi Kivity , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 33/36] pipe: convert to ->poll_mask Date: Mon, 22 Jan 2018 21:12:40 +0100 Message-Id: <20180122201243.31610-34-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180122201243.31610-1-hch@lst.de> References: <20180122201243.31610-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Christoph Hellwig --- fs/pipe.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index a449ca0ec0c6..33a32d13b83d 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -514,19 +514,22 @@ static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) } } -/* No kernel lock held - fine */ -static __poll_t -pipe_poll(struct file *filp, poll_table *wait) +static struct wait_queue_head * +pipe_get_poll_head(struct file *filp, __poll_t events) { - __poll_t mask; struct pipe_inode_info *pipe = filp->private_data; - int nrbufs; - poll_wait(filp, &pipe->wait, wait); + return &pipe->wait; +} + +/* No kernel lock held - fine */ +static __poll_t pipe_poll_mask(struct file *filp, __poll_t events) +{ + struct pipe_inode_info *pipe = filp->private_data; + int nrbufs = pipe->nrbufs; + __poll_t mask = 0; /* Reading only -- no need for acquiring the semaphore. */ - nrbufs = pipe->nrbufs; - mask = 0; if (filp->f_mode & FMODE_READ) { mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0; if (!pipe->writers && filp->f_version != pipe->w_counter) @@ -1010,7 +1013,8 @@ const struct file_operations pipefifo_fops = { .llseek = no_llseek, .read_iter = pipe_read, .write_iter = pipe_write, - .poll = pipe_poll, + .get_poll_head = pipe_get_poll_head, + .poll_mask = pipe_poll_mask, .unlocked_ioctl = pipe_ioctl, .release = pipe_release, .fasync = pipe_fasync, -- 2.14.2