From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D29A0C433FE for ; Mon, 24 Jan 2022 08:56:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E4FF6B0081; Mon, 24 Jan 2022 03:56:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6944A6B0083; Mon, 24 Jan 2022 03:56:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 583926B0085; Mon, 24 Jan 2022 03:56:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 4BA436B0081 for ; Mon, 24 Jan 2022 03:56:31 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 14C2C8F842 for ; Mon, 24 Jan 2022 08:56:31 +0000 (UTC) X-FDA: 79064574582.20.9B693A2 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id C09E316001A for ; Mon, 24 Jan 2022 08:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=UeEStLq1BcaRCxlc7CK5jWbcG0Yi+4h/9FQlvr3ixBU=; b=AqbURbgTjyxvDrFz8NjYHx7gka p7fHZJQ/PKW4QktMWpkLsjNHc+NXOBgYeYxw7buCKzE9cI6oj3i7jvbO3oTjoQIVILFYSeOq+vR6C 0O6aWDNH6kvejWIMRISU2QEzLkGfSAo2b2tVQxfr+feytZxFq1lRNPiBuKCekf/osPEOVsudAVJnI HcmglMDhItYNdfWJeKjtbnnChfOvmzpD8HVHELXXSeDpQkRejvKlmlgr0xzTzm7zY1AmpxTS9c6X/ ZAomAuKWJDJ9NddslHFKG2OTjts/MYHkXRux/lI3lf9czp+iXnlxKwhKMm6GEs5VPRxsokUsrbxCN 8VutyOiA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBv9F-002h4I-0F; Mon, 24 Jan 2022 08:56:25 +0000 Date: Mon, 24 Jan 2022 00:56:24 -0800 From: Christoph Hellwig To: NeilBrown Cc: Trond Myklebust , Anna Schumaker , Chuck Lever , Andrew Morton , Mel Gorman , Christoph Hellwig , David Howells , linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 11/23] VFS: Add FMODE_CAN_ODIRECT file flag Message-ID: References: <164299573337.26253.7538614611220034049.stgit@noble.brown> <164299611280.26253.2845018521780218144.stgit@noble.brown> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164299611280.26253.2845018521780218144.stgit@noble.brown> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Stat-Signature: hzuo7z4tuajq4wqwpth1dqbns35icxm8 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=AqbURbgT; spf=none (imf08.hostedemail.com: domain of BATV+b18af077b488c69bdec9+6728+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b18af077b488c69bdec9+6728+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C09E316001A X-HE-Tag: 1643014590-742335 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 24, 2022 at 02:48:32PM +1100, NeilBrown wrote: > Currently various places test if direct IO is possible on a file by > checking for the existence of the direct_IO address space operation. > This is a poor choice, as the direct_IO operation may not be used - it is > only used if the generic_file_*_iter functions are called for direct IO > and some filesystems - particularly NFS - don't do this. > > Instead, introduce a new f_mode flag: FMODE_CAN_ODIRECT and change the > various places to check this (avoiding pointer dereferences). > do_dentry_open() will set this flag if ->direct_IO is present, so > filesystems do not need to be changed. > > NFS *is* changed, to set the flag explicitly and discard the direct_IO > entry in the address_space_operations for files. Looks good: Reviewed-by: Christoph Hellwig It would be nice to throw in a cleanup to remove noop_direct_IO as well.