Commit 891fced6 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMike Snitzer <snitzer@redhat.com>
Link: https://lore.kernel.org/r/20220202160109.108149-9-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 1d1068ce
...@@ -1241,15 +1241,6 @@ static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci, ...@@ -1241,15 +1241,6 @@ static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci,
struct bio *bio; struct bio *bio;
int try; 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++) { for (try = 0; try < 2; try++) {
int bio_nr; int bio_nr;
...@@ -1279,12 +1270,23 @@ static void __send_duplicate_bios(struct clone_info *ci, struct dm_target *ti, ...@@ -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_list blist = BIO_EMPTY_LIST;
struct bio *clone; struct bio *clone;
alloc_multiple_bios(&blist, ci, ti, num_bios, len); switch (num_bios) {
case 0:
while ((clone = bio_list_pop(&blist))) { break;
case 1:
clone = alloc_tio(ci, ti, 0, len, GFP_NOIO);
if (len) if (len)
bio_setup_sector(clone, ci->sector, *len); bio_setup_sector(clone, ci->sector, *len);
__map_bio(clone); __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;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment