diff options
author | Linus Torvalds | 2018-06-08 10:00:20 -0700 |
---|---|---|
committer | Linus Torvalds | 2018-06-08 10:00:20 -0700 |
commit | 4a189982e293e662d719f5dd3ba6eec247d7bbc2 (patch) | |
tree | a2384a2e4f56999a15fa80f0a07bff9fe23597f3 /include/linux/fs.h | |
parent | 4189b863ba327bac4a869773aea4995f7716945a (diff) | |
parent | 9a6d9a62e0fd4b9927c3124db0f25fc6b4fb6576 (diff) |
Merge branch 'work.aio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull aio iopriority support from Al Viro:
"The rest of aio stuff for this cycle - Adam's aio ioprio series"
* 'work.aio' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fs: aio ioprio use ioprio_check_cap ret val
fs: aio ioprio add explicit block layer dependence
fs: iomap dio set bio prio from kiocb prio
fs: blkdev set bio prio from kiocb prio
fs: Add aio iopriority support
fs: Convert kiocb rw_hint from enum to u16
block: add ioprio_check_cap function
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 77333ed3a488..7207de8c4e9a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -36,6 +36,7 @@ #include <linux/delayed_call.h> #include <linux/uuid.h> #include <linux/errseq.h> +#include <linux/ioprio.h> #include <asm/byteorder.h> #include <uapi/linux/fs.h> @@ -299,7 +300,8 @@ struct kiocb { void (*ki_complete)(struct kiocb *iocb, long ret, long ret2); void *private; int ki_flags; - enum rw_hint ki_hint; + u16 ki_hint; + u16 ki_ioprio; /* See linux/ioprio.h */ } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) @@ -1934,12 +1936,22 @@ static inline enum rw_hint file_write_hint(struct file *file) static inline int iocb_flags(struct file *file); +static inline u16 ki_hint_validate(enum rw_hint hint) +{ + typeof(((struct kiocb *)0)->ki_hint) max_hint = -1; + + if (hint <= max_hint) + return hint; + return 0; +} + static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) { *kiocb = (struct kiocb) { .ki_filp = filp, .ki_flags = iocb_flags(filp), - .ki_hint = file_write_hint(filp), + .ki_hint = ki_hint_validate(file_write_hint(filp)), + .ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0), }; } |