Received: by 10.223.148.5 with SMTP id 5csp6272100wrq; Wed, 17 Jan 2018 11:32:49 -0800 (PST) X-Google-Smtp-Source: ACJfBosVKw5HcCE3CUFNfaINiqBas2LXB5TByl4Q0KF8jazVaaz7mmSJ9StL7tX3nFcBCYoLsgWM X-Received: by 10.99.144.76 with SMTP id a73mr31450209pge.376.1516217569745; Wed, 17 Jan 2018 11:32:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516217569; cv=none; d=google.com; s=arc-20160816; b=yKqvTKy4+0vOhajEO0ef+hAUpmj0R8St3sPSY/ojRjq576ygRiUGIvkns6FxQkbXEt w14bhUhV/TSwml3Sl8w6bYpdeAGBAda3mE5c9Bv2Y4LKMooAatUAxk1kdT5CPNPIM5RF kCI0F8y51eT5ZoEd8qgtyA1swoZU7ujHxyjLzjY+idW5wvij0ID01HZCC9auPoi0TRkM IwMlijDQlw0MhDFSmUb9qRDs54Yt5ers+7ZNPVjBfEHriZZJHwHoUBYTgBxs1M2iORAd 6YEtL2AKsKtCJhSsakc0twJfSOU+GI0wtvc1e/DjPVNTP6jrP164HQn5CYbxHiigcD1P yvcA== 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=jjPK/166fVINEWE1BYcfPtny8zDPYvXh2+NHII4mkwp3HO3qWTrTzSMGwHw6LTujLe /v1Jkj5erCs2IvQInUaNqERTYqZhqJwHCqXv1WF5k9NBk6cGGDkaulzifUhJPiOHlg0t 3C2W3Sq3SpyhNM38wtKEGJ6Mv2lyitdIOaxnEDEK3GiUllM4SfRGzNHDKVn+KPPykI2G P6qlXLGaFB6BlhF0w40JDTielASKp3EVs11fVnN8bBzl1TxYTwbdLWfjV6VGo3/+UCk9 Uh4buEvUFvMP79V8TQ+9mNZ7aTGhjlQwWwZ8FbdTbQ66ynG6TiB7ABUrpZrFO4Y5yCCn LRYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=anns1XOC; 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 p19si4937708plo.199.2018.01.17.11.32.36; Wed, 17 Jan 2018 11:32:49 -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=anns1XOC; 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 S932218AbeAQT3s (ORCPT + 99 others); Wed, 17 Jan 2018 14:29:48 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:59345 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932182AbeAQT3o (ORCPT ); Wed, 17 Jan 2018 14:29:44 -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=anns1XOCdGuxamnnANuzYYldz BJCYyeQMBx6YN7Y6D0QkhE4OC6Kxbg2QmKzmzRp090TvZJpjoSA9QuG7occEKWbik0BE8lExSqnQI YN311WK3hTbNIBHcyYgNVK/Xs/l8wgvLSV+qd840pIRNS7ZZl02sXUHRRqz7t6j1R25cmc2FeYvi3 WvheS9D0hPTcEjTwZLukecGzKtftr8izuiyZ9V4t4x/EShJIZt/qzVQtxXX0Hcx8gnbcy6yCRpE09 jY2Q5Hs7jTDo+emhryVzqDvF2wHhEvjsGoP6NQaAG2yPfQwbJlB6yOq2mO2hSYTMXTBC6B/4l0zuN HZiwpZ4Ig==; Received: from 77.117.185.35.wireless.dyn.drei.com ([77.117.185.35] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ebtP4-0003Qs-Ar; Wed, 17 Jan 2018 19:29:42 +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: Wed, 17 Jan 2018 20:27:39 +0100 Message-Id: <20180117192742.710-34-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180117192742.710-1-hch@lst.de> References: <20180117192742.710-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