]> www.infradead.org Git - users/jedix/linux-maple.git/commit
VFS: Add FMODE_CAN_ODIRECT file flag
authorNeilBrown <neilb@suse.de>
Thu, 14 Apr 2022 06:07:03 +0000 (23:07 -0700)
committerakpm <akpm@linux-foundation.org>
Thu, 14 Apr 2022 06:07:03 +0000 (23:07 -0700)
commit02b7cb8e11e85f895e11057a6bcd88f66006d49e
tree4f20bb7f8f7d7daa4cd6299c607cb39affbfcb0d
parent4ef225cf1f5951a5aae056c010b558a49969733b
VFS: Add FMODE_CAN_ODIRECT file flag

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.

Other filesystems which currently use noop_direct_IO could usefully be
changed to set this flag instead.

Link: https://lkml.kernel.org/r/164859778128.29473.15189737957277399416.stgit@noble.brown
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: NeilBrown <neilb@suse.de>
Tested-by: David Howells <dhowells@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/loop.c
fs/fcntl.c
fs/nfs/file.c
fs/open.c
fs/overlayfs/file.c
include/linux/fs.h