Message ID | 20180430165740.2842-2-adam.manzanares@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Apr 30, 2018 at 09:57:39AM -0700, adam.manzanares@wdc.com wrote: > From: Adam Manzanares <adam.manzanares@wdc.com> > > This is the per-I/O equivalent of the ioprio_set system call. > > When the RWF_IOPRIO flag is set then the aio_reqprio field of the iocb > is interpreted as an I/O scheduling class and priority. I think this belongs into the IOCB_FLAG_* flags namespace for aio_flags field as it isn't a field valid for plain read/write. Also you probably want to merge both patches as they only really make sense together.
On 5/2/18 10:32 AM, Christoph Hellwig wrote: > On Mon, Apr 30, 2018 at 09:57:39AM -0700, adam.manzanares@wdc.com wrote: >> From: Adam Manzanares <adam.manzanares@wdc.com> >> >> This is the per-I/O equivalent of the ioprio_set system call. >> >> When the RWF_IOPRIO flag is set then the aio_reqprio field of the iocb >> is interpreted as an I/O scheduling class and priority. > > I think this belongs into the IOCB_FLAG_* flags namespace for aio_flags > field as it isn't a field valid for plain read/write. > > Also you probably want to merge both patches as they only really > make sense together. > I will make the changes and send out a v2.
diff --git a/include/linux/fs.h b/include/linux/fs.h index 760d8da1b6c7..32614eb72a4a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -292,6 +292,7 @@ enum rw_hint { #define IOCB_SYNC (1 << 5) #define IOCB_WRITE (1 << 6) #define IOCB_NOWAIT (1 << 7) +#define IOCB_IOPRIO (1 << 8) struct kiocb { struct file *ki_filp; @@ -300,6 +301,7 @@ struct kiocb { void *private; int ki_flags; enum rw_hint ki_hint; + u16 ki_ioprio; /* See linux/ioprio.h */ } __randomize_layout; static inline bool is_sync_kiocb(struct kiocb *kiocb) @@ -3243,6 +3245,8 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags) ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC); if (flags & RWF_APPEND) ki->ki_flags |= IOCB_APPEND; + if (flags & RWF_IOPRIO) + ki->ki_flags |= IOCB_IOPRIO; return 0; } diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index d2a8313fabd7..c8f69a00b566 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -380,8 +380,11 @@ typedef int __bitwise __kernel_rwf_t; /* per-IO O_APPEND */ #define RWF_APPEND ((__force __kernel_rwf_t)0x00000010) +/* per-IO IOPRIO */ +#define RWF_IOPRIO ((__force __kernel_rwf_t)0x00000020) + /* mask of flags supported by the kernel */ #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\ - RWF_APPEND) + RWF_APPEND | RWF_IOPRIO) #endif /* _UAPI_LINUX_FS_H */