• Damien Le Moal's avatar
    scsi: block: ioprio: Clean up interface definition · eca20409
    Damien Le Moal authored
    The I/O priority user interface defines the 16-bits ioprio values as the
    combination of the upper 3-bits for an I/O priority class and the lower
    13-bits as priority data. However, the kernel only uses the lower 3-bits of
    the priority data to define priority levels for the RT and BE priority
    classes. The data part of an ioprio value is completely ignored for the
    IDLE and NONE classes. This is enforced by checks done in
    ioprio_check_cap(), which is called for all paths that allow defining an
    I/O priority for I/Os: the per-context ioprio_set() system call, aio
    interface and io_uring interface.
    
    Clarify this fact in the uapi ioprio.h header file and introduce the
    IOPRIO_PRIO_LEVEL_MASK and IOPRIO_PRIO_LEVEL() macros for users to define
    and get priority levels in an ioprio value. The coarser macro
    IOPRIO_PRIO_DATA() is retained for backward compatibility with old
    applications already using it. There is no functional change introduced
    with this.
    
    In-kernel users of the IOPRIO_PRIO_DATA() macro which are explicitly
    handling I/O priority data as a priority level are modified to use the new
    IOPRIO_PRIO_LEVEL() macro without any functional change. Since f2fs is the
    only user of this macro not explicitly using that value as a priority
    level, it is left unchanged.
    Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
    Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
    Link: https://lore.kernel.org/r/20230511011356.227789-2-nks@flawful.orgSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    eca20409
bfq-iosched.c 264 KB