@@ -322,6 +322,7 @@ struct readahead_control;
322
322
#define IOCB_NOWAIT (__force int) RWF_NOWAIT
323
323
#define IOCB_APPEND (__force int) RWF_APPEND
324
324
#define IOCB_ATOMIC (__force int) RWF_ATOMIC
325
+ #define IOCB_DONTCACHE (__force int) RWF_DONTCACHE
325
326
326
327
/* non-RWF related bits - start at 16 */
327
328
#define IOCB_EVENTFD (1 << 16)
@@ -356,7 +357,8 @@ struct readahead_control;
356
357
{ IOCB_SYNC, "SYNC" }, \
357
358
{ IOCB_NOWAIT, "NOWAIT" }, \
358
359
{ IOCB_APPEND, "APPEND" }, \
359
- { IOCB_ATOMIC, "ATOMIC"}, \
360
+ { IOCB_ATOMIC, "ATOMIC" }, \
361
+ { IOCB_DONTCACHE, "DONTCACHE" }, \
360
362
{ IOCB_EVENTFD, "EVENTFD"}, \
361
363
{ IOCB_DIRECT, "DIRECT" }, \
362
364
{ IOCB_WRITE, "WRITE" }, \
@@ -2127,6 +2129,8 @@ struct file_operations {
2127
2129
#define FOP_UNSIGNED_OFFSET ((__force fop_flags_t)(1 << 5))
2128
2130
/* Supports asynchronous lock callbacks */
2129
2131
#define FOP_ASYNC_LOCK ((__force fop_flags_t)(1 << 6))
2132
+ /* File system supports uncached read/write buffered IO */
2133
+ #define FOP_DONTCACHE ((__force fop_flags_t)(1 << 7))
2130
2134
2131
2135
/* Wrap a directory iterator that needs exclusive inode access */
2132
2136
int wrap_directory_iterator (struct file * , struct dir_context * ,
@@ -3614,6 +3618,14 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags,
3614
3618
if (!(ki -> ki_filp -> f_mode & FMODE_CAN_ATOMIC_WRITE ))
3615
3619
return - EOPNOTSUPP ;
3616
3620
}
3621
+ if (flags & RWF_DONTCACHE ) {
3622
+ /* file system must support it */
3623
+ if (!(ki -> ki_filp -> f_op -> fop_flags & FOP_DONTCACHE ))
3624
+ return - EOPNOTSUPP ;
3625
+ /* DAX mappings not supported */
3626
+ if (IS_DAX (ki -> ki_filp -> f_mapping -> host ))
3627
+ return - EOPNOTSUPP ;
3628
+ }
3617
3629
kiocb_flags |= (__force int ) (flags & RWF_SUPPORTED );
3618
3630
if (flags & RWF_SYNC )
3619
3631
kiocb_flags |= IOCB_DSYNC ;
0 commit comments