• Kiyoshi Ueda's avatar
    block: add lld busy state exporting interface · ef9e3fac
    Kiyoshi Ueda authored
    This patch adds an new interface, blk_lld_busy(), to check lld's
    busy state from the block layer.
    blk_lld_busy() calls down into low-level drivers for the checking
    if the drivers set q->lld_busy_fn() using blk_queue_lld_busy().
    
    This resolves a performance problem on request stacking devices below.
    
    Some drivers like scsi mid layer stop dispatching request when
    they detect busy state on its low-level device like host/target/device.
    It allows other requests to stay in the I/O scheduler's queue
    for a chance of merging.
    
    Request stacking drivers like request-based dm should follow
    the same logic.
    However, there is no generic interface for the stacked device
    to check if the underlying device(s) are busy.
    If the request stacking driver dispatches and submits requests to
    the busy underlying device, the requests will stay in
    the underlying device's queue without a chance of merging.
    This causes performance problem on burst I/O load.
    
    With this patch, busy state of the underlying device is exported
    via q->lld_busy_fn().  So the request stacking driver can check it
    and stop dispatching requests if busy.
    
    The underlying device driver must return the busy state appropriately:
        1: when the device driver can't process requests immediately.
        0: when the device driver can process requests immediately,
           including abnormal situations where the device driver needs
           to kill all requests.
    Signed-off-by: default avatarKiyoshi Ueda <k-ueda@ct.jp.nec.com>
    Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
    ef9e3fac
blkdev.h 32 KB