ceph: add new "nopagecache" option
authorJeff Layton <jlayton@kernel.org>
Tue, 30 Nov 2021 19:12:13 +0000 (14:12 -0500)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 13 Jan 2022 12:40:07 +0000 (13:40 +0100)
commit94cc0877cad0bc6ca84686c4fa874bf530eb8b88
treef0b81d20b964a613d91b0453d8a085615fd298bd
parent0078ea3b0566e3da09ae8e1e4fbfd708702f2876
ceph: add new "nopagecache" option

CephFS is a bit unlike most other filesystems in that it only
conditionally does buffered I/O based on the caps that it gets from the
MDS. In most cases, unless there is contended access for an inode the
MDS does give Fbc caps to the client, so the unbuffered codepaths are
only infrequently traveled and are difficult to test.

At one time, the "-o sync" mount option would give you this behavior,
but that was removed in commit 7ab9b3807097 ("ceph: Don't use
ceph-sync-mode for synchronous-fs.").

Add a new mount option to tell the client to ignore Fbc caps when doing
I/O, and to use the synchronous codepaths exclusively, even on
non-O_DIRECT file descriptors. We already have an ioctl that forces this
behavior on a per-file basis, so we can just always set the CEPH_F_SYNC
flag in the file description on such mounts.

Additionally, this patch also changes the client to not request Fbc when
doing direct I/O. We aren't using the cache with O_DIRECT so we don't
have any need for those caps.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Greg Farnum <gfarnum@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/file.c
fs/ceph/super.c
fs/ceph/super.h