RWF_HIPRI, IOCB_HIPRI,REQ_HIPRI这些flag与对后端设备IO硬件队列的poll操作有直接联系,
RWF_HIPRI (since Linux 4.6)
High priority read/write. Allows block-based filesystems to use polling of the device, which provides lower latency(这个在下面代码注释中解释了其实现lower latency的原理), but may use additional resources. (Currently, this feature is usable only on a file descriptor opened using the O_DIRECT flag.)
在用户态如果设置了该flag,表示该操作产生的io是高优先级IO,需要时采用polling操作来确认IO是否完成;
在内核代码,将RWF_HIPRI转化为iocb的flag,即IOCB_HIPRI:
在块设备__blkdev_direct_IO函数最后,在调用submit_bio提交io之后,对于同步IO与异步IO会有不同的处理。如果是异步IO,就直接返回给用户态了;如果是同步IO,则需要在当前内核态代码中判断IO是否完成(并根据是否设置