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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0ADFC433EF for ; Wed, 26 Jan 2022 22:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233038AbiAZWOv (ORCPT ); Wed, 26 Jan 2022 17:14:51 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:41022 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbiAZWOt (ORCPT ); Wed, 26 Jan 2022 17:14:49 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8FDB121115; Wed, 26 Jan 2022 22:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1643235288; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XAxGUgZjMfRYcheCAvGcdbuwhS+6jxtGJ++NzQbXLbs=; b=mff66aUsTySR80NmIG6DFMDZ8GOSZWBzAb6QezcCyekTKeq0vaL4p57+me2lhVr9SxNgDq 5PrkZNO/w2zB5kgRuauSKoDUKN1aObBFWp1LheRHzZACgfpO+VXiiCtPEZKhuzochTgn4x dQuDMpHgMQMZt9xRtxBxbL4VkOHvKaw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1643235288; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XAxGUgZjMfRYcheCAvGcdbuwhS+6jxtGJ++NzQbXLbs=; b=qZsxwnV2bCYEJrrqd0i6b3VKdv+EWpeCYEtnRvGhfI7zYjGmVoQzl23i75fR7TVdDKLmGa 4wqjwIkIgmIH2aAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7C2361330C; Wed, 26 Jan 2022 22:14:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rMG3DdXH8WH4TQAAMHmgww (envelope-from ); Wed, 26 Jan 2022 22:14:45 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "Christoph Hellwig" 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 In-reply-to: References: <164299573337.26253.7538614611220034049.stgit@noble.brown>, <164299611280.26253.2845018521780218144.stgit@noble.brown>, Date: Thu, 27 Jan 2022 09:14:41 +1100 Message-id: <164323528189.5493.7196087998245554506@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Jan 2022, Christoph Hellwig wrote: > 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. I don't want to add this to the present series. When it lands I'll send patches to the various filesystems to switch to using FMODE_CAN_ODIRECT. Thanks, NeilBrown