linux/fs/overlayfs
NeilBrown a2ad63daa8 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>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Hugh Dickins <hughd@google.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-05-09 18:20:49 -07:00
..
copy_up.c ovl: don't fail copy up if no fileattr support on upper 2022-01-14 16:57:56 +01:00
dir.c ovl: fix warning in ovl_create_real() 2021-11-04 10:55:34 +01:00
export.c ovl: fix uninitialized pointer read in ovl_lookup_real_one() 2021-08-10 10:21:30 +02:00
file.c VFS: add FMODE_CAN_ODIRECT file flag 2022-05-09 18:20:49 -07:00
inode.c ovl: fix filattr copy-up failure 2021-11-04 14:04:52 +01:00
Kconfig docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c ovl: relax lookup error on mismatch origin ftype 2021-08-17 11:47:44 +02:00
overlayfs.h ovl: fix warning in ovl_create_real() 2021-11-04 10:55:34 +01:00
ovl_entry.h ovl: implement volatile-specific fsync error behaviour 2021-01-28 10:22:48 +01:00
readdir.c ovl: skip stale entries in merge dir cache iteration 2021-08-10 10:21:30 +02:00
super.c fs: allocate inode by using alloc_inode_sb() 2022-03-22 15:57:03 -07:00
util.c ovl: consistent behavior for immutable/append-only inodes 2021-08-17 11:47:43 +02:00