From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932187AbeAHKoY (ORCPT + 1 other); Mon, 8 Jan 2018 05:44:24 -0500 Received: from verein.lst.de ([213.95.11.211]:35515 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755999AbeAHKoV (ORCPT ); Mon, 8 Jan 2018 05:44:21 -0500 Date: Mon, 8 Jan 2018 11:44:19 +0100 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , Avi Kivity , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/31] fs: add new vfs_poll and file_can_poll helpers Message-ID: <20180108104419.GA5797@lst.de> References: <20180104080043.14506-1-hch@lst.de> <20180104080043.14506-3-hch@lst.de> <20180106190853.GH21978@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180106190853.GH21978@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sat, Jan 06, 2018 at 07:08:53PM +0000, Al Viro wrote: > On Thu, Jan 04, 2018 at 09:00:14AM +0100, Christoph Hellwig wrote: > > These abstract out calls to the poll method in preparation for changes to > > those methods. > > FWIW, I would make vfs_poll() > > static inline __poll_t vfs_poll(struct file *file, struct poll_table_struct *pt) > { > if (unlikely(!file->f_op->poll)) > return DEFAULT_POLLMASK; > return file->f_op->poll(file, pt); > } > > That's safe for any struct file, some of the callers already do just that, > the ones that have vfs_poll() under the check for file_can_poll() will > simply optimize that piece away and the few that rely upon the knowledge > of file_operations they are dealing with (vhost, etc.) can bloody well > cope with the cost of the check. Sure, works for me.