• Mike Snitzer's avatar
    dm: enhance alloc_multiple_bios() to be more versatile · 4a2fe296
    Mike Snitzer authored
    alloc_multiple_bios() has the useful ability to try allocating bios
    with GFP_NOWAIT but will fallback to using GFP_NOIO.  The callers
    service both empty flush bios and abnormal bios (e.g. discard).
    
    alloc_multiple_bios() enhancements offered in this commit:
    - don't require table_devices_lock if num_bios = 1
    - allow caller to pass GFP_NOWAIT to do usual GFP_NOWAIT with GFP_NOIO
      fallback
    - allow caller to pass GFP_NOIO to _only_ allocate using GFP_NOIO
    
    Flush bios with data may be issued to DM with REQ_NOWAIT, as such it
    makes sense to attempt servicing them with GFP_NOWAIT allocations.
    
    But abnormal IO should never be issued using REQ_NOWAIT (if that
    changes in the future that's fine, but no sense supporting it now).
    
    While at it, rename __send_changing_extent_only() to
    __send_abnormal_io().
    
    [Thanks to both Ming and Mikulas for help with translating known
    possible IO scenarios to requirements.]
    Suggested-by: default avatarMing Lei <ming.lei@redhat.com>
    Suggested-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
    4a2fe296
dm.c 80.6 KB