summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2022-02-18 05:40:14 +0100
committerMike Snitzer <snitzer@redhat.com>2022-02-21 21:36:25 +0100
commit90a2326edede9e801e45c24b3c71f3092b279b66 (patch)
tree7a123ab469d24563e9f2654c9bba3c45a07c5e59 /drivers/md
parentdm: refactor dm_split_and_process_bio a bit (diff)
downloadlinux-90a2326edede9e801e45c24b3c71f3092b279b66.tar.xz
linux-90a2326edede9e801e45c24b3c71f3092b279b66.zip
dm: reduce code duplication in __map_bio
Error path code (for handling DM_MAPIO_REQUEUE and DM_MAPIO_KILL) is effectively identical. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index c01bfa3b6544..fb129fe94a0d 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1180,20 +1180,14 @@ static void __map_bio(struct bio *clone)
submit_bio_noacct(clone);
break;
case DM_MAPIO_KILL:
- if (unlikely(swap_bios_limit(ti, clone))) {
- struct mapped_device *md = io->md;
- up(&md->swap_bios_semaphore);
- }
- free_tio(clone);
- dm_io_dec_pending(io, BLK_STS_IOERR);
- break;
case DM_MAPIO_REQUEUE:
- if (unlikely(swap_bios_limit(ti, clone))) {
- struct mapped_device *md = io->md;
- up(&md->swap_bios_semaphore);
- }
+ if (unlikely(swap_bios_limit(ti, clone)))
+ up(&io->md->swap_bios_semaphore);
free_tio(clone);
- dm_io_dec_pending(io, BLK_STS_DM_REQUEUE);
+ if (r == DM_MAPIO_KILL)
+ dm_io_dec_pending(io, BLK_STS_IOERR);
+ else
+ dm_io_dec_pending(io, BLK_STS_DM_REQUEUE);
break;
default:
DMWARN("unimplemented target map return value: %d", r);