diff options
author | Christoph Hellwig <hch@lst.de> | 2022-02-02 19:01:04 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-02-04 17:43:17 +0300 |
commit | 891fced644a7529bfd4b1436b2341527ce8f68ad (patch) | |
tree | 04f695435e768a2f6b0cad410c7d60120175145b /drivers/md | |
parent | 1d1068cecff70cb8e48c7cb0ba27cc3fd906eb31 (diff) | |
download | linux-891fced644a7529bfd4b1436b2341527ce8f68ad.tar.xz |
dm: simplify the single bio fast path in __send_duplicate_bios
Most targets just need a single flush bio. Open code that case in
__send_duplicate_bios without the need to add the bio to a list.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Link: https://lore.kernel.org/r/20220202160109.108149-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index c05b6ff1bb95..78df75f57288 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1241,15 +1241,6 @@ static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci, struct bio *bio; int try; - if (!num_bios) - return; - - if (num_bios == 1) { - bio = alloc_tio(ci, ti, 0, len, GFP_NOIO); - bio_list_add(blist, bio); - return; - } - for (try = 0; try < 2; try++) { int bio_nr; @@ -1279,12 +1270,23 @@ static void __send_duplicate_bios(struct clone_info *ci, struct dm_target *ti, struct bio_list blist = BIO_EMPTY_LIST; struct bio *clone; - alloc_multiple_bios(&blist, ci, ti, num_bios, len); - - while ((clone = bio_list_pop(&blist))) { + switch (num_bios) { + case 0: + break; + case 1: + clone = alloc_tio(ci, ti, 0, len, GFP_NOIO); if (len) bio_setup_sector(clone, ci->sector, *len); __map_bio(clone); + break; + default: + alloc_multiple_bios(&blist, ci, ti, num_bios, len); + while ((clone = bio_list_pop(&blist))) { + if (len) + bio_setup_sector(clone, ci->sector, *len); + __map_bio(clone); + } + break; } } |