• Kiyoshi Ueda's avatar
    dm mpath: change to be request based · f40c67f0
    Kiyoshi Ueda authored
    This patch converts dm-multipath target to request-based from bio-based.
    
    Basically, the patch just converts the I/O unit from struct bio
    to struct request.
    In the course of the conversion, it also changes the I/O queueing
    mechanism.  The change in the I/O queueing is described in details
    as follows.
    
    I/O queueing mechanism change
    -----------------------------
    In I/O submission, map_io(), there is no mechanism change from
    bio-based, since the clone request is ready for retry as it is.
    However, in I/O complition, do_end_io(), there is a mechanism change
    from bio-based, since the clone request is not ready for retry.
    
    In do_end_io() of bio-based, the clone bio has all needed memory
    for resubmission.  So the target driver can queue it and resubmit
    it later without memory allocations.
    The mechanism has almost no overhead.
    
    On the other hand, in do_end_io() of request-based, the clone request
    doesn't have clone bios, so the target driver can't resubmit it
    as it is.  To resubmit the clone request, memory allocation for
    clone bios is needed, and it takes some overheads.
    To avoid the overheads just for queueing, the target driver doesn't
    queue the clone request inside itself.
    Instead, the target driver asks dm core for queueing and remapping
    the original request of the clone request, since the overhead for
    queueing is just a freeing memory for the clone request.
    
    As a result, the target driver doesn't need to record/restore
    the information of the original request for resubmitting
    the clone request.  So dm_bio_details in dm_mpath_io is removed.
    
    multipath_busy()
    ---------------------
    The target driver returns "busy", only when the following case:
      o The target driver will map I/Os, if map() function is called
      and
      o The mapped I/Os will wait on underlying device's queue due to
        their congestions, if map() function is called now.
    
    In other cases, the target driver doesn't return "busy".
    Otherwise, dm core will keep the I/Os and the target driver can't
    do what it wants.
    (e.g. the target driver can't map I/Os now, so wants to kill I/Os.)
    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>
    Acked-by: default avatarHannes Reinecke <hare@suse.de>
    Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
    f40c67f0
dm-mpath.c 36.7 KB