Skip to content

Commit

Permalink
dm: reduce code duplication in __map_bio
Browse files Browse the repository at this point in the history
Error path code (for handling DM_MAPIO_REQUEUE and DM_MAPIO_KILL) is
effectively identical.

Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mikulas Patocka <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
  • Loading branch information
snitm committed Feb 21, 2022
1 parent d41e077 commit 90a2326
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 90a2326

Please sign in to comment.