Commit 90a2326e authored by Mike Snitzer's avatar Mike Snitzer

dm: reduce code duplication in __map_bio

Error path code (for handling DM_MAPIO_REQUEUE and DM_MAPIO_KILL) is
effectively identical.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent d41e077a
...@@ -1180,20 +1180,14 @@ static void __map_bio(struct bio *clone) ...@@ -1180,20 +1180,14 @@ static void __map_bio(struct bio *clone)
submit_bio_noacct(clone); submit_bio_noacct(clone);
break; break;
case DM_MAPIO_KILL: 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: case DM_MAPIO_REQUEUE:
if (unlikely(swap_bios_limit(ti, clone))) { if (unlikely(swap_bios_limit(ti, clone)))
struct mapped_device *md = io->md; up(&io->md->swap_bios_semaphore);
up(&md->swap_bios_semaphore);
}
free_tio(clone); 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; break;
default: default:
DMWARN("unimplemented target map return value: %d", r); DMWARN("unimplemented target map return value: %d", r);
......
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