Thread (51 messages) flat view 51 messages, 3 authors, 2018-01-10

Re: [PATCH 02/31] fs: add new vfs_poll and file_can_poll helpers

From: Christoph Hellwig <hch@lst.de>
Date: 2018-01-08 10:44:19
Also in: linux-fsdevel, lkml

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:
quoted
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.

--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help