dm: enhance alloc_multiple_bios() to be more versatile
authorMike Snitzer <snitzer@kernel.org>
Fri, 27 Oct 2023 15:29:36 +0000 (11:29 -0400)
committerMike Snitzer <snitzer@kernel.org>
Fri, 27 Oct 2023 16:44:18 +0000 (12:44 -0400)
commit4a2fe2960891f1ccd7805d0973284fd44c2f12b4
tree52572778a4f0036060f350e6ab25aff48e611c9b
parent34dbaa88cab121437d711bb7b9673c16eed4f922
dm: enhance alloc_multiple_bios() to be more versatile

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: Ming Lei <ming.lei@redhat.com>
Suggested-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm.c