Avoids the need to open code do_iter_readv_writev() purely to request that a sync iocb make use of IOCB_DIRECT. Care was taken to preserve the long-established value for IOCB_DIRECT (1 << 17) when introducing RWF_DIRECT. Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> --- include/linux/fs.h | 2 +- include/uapi/linux/fs.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index ed025959d1bd..9bf5543926f8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -324,7 +324,7 @@ struct readahead_control; /* non-RWF related bits - start at 16 */ #define IOCB_EVENTFD (1 << 16) -#define IOCB_DIRECT (1 << 17) +#define IOCB_DIRECT (__force int) RWF_DIRECT #define IOCB_WRITE (1 << 18) /* iocb->ki_waitq is valid */ #define IOCB_WAITQ (1 << 19) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 56a4f93a08f4..e0d00a7c336a 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -335,10 +335,13 @@ typedef int __bitwise __kernel_rwf_t; /* buffered IO that drops the cache after reading or writing data */ #define RWF_DONTCACHE ((__force __kernel_rwf_t)0x00000080) +/* per-IO O_DIRECT, using (1 << 17) or 0x00020000 for compat with IOCB_DIRECT */ +#define RWF_DIRECT ((__force __kernel_rwf_t)(1 << 17)) + /* mask of flags supported by the kernel */ #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC |\ - RWF_DONTCACHE) + RWF_DONTCACHE | RWF_DIRECT) #define PROCFS_IOCTL_MAGIC 'f' -- 2.44.0