summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-02-02 19:01:07 +0300
committerJens Axboe <axboe@kernel.dk>2022-02-04 17:43:18 +0300
commit92986f6b4c8a2c24d3a36b80140624f80fd93de4 (patch)
tree16225c5aede600c6adbd5d09d38d7044f003da2b /drivers/md
parent56b4b5abcdab6daf71c5536fca2772f178590e06 (diff)
downloadlinux-92986f6b4c8a2c24d3a36b80140624f80fd93de4.tar.xz
dm: use bio_clone_fast in alloc_io/alloc_tio
Replace open coded bio_clone_fast implementations with the actual helper. Note that the bio allocated as part of the dm_io structure in alloc_io will only actually be used later in alloc_tio, making this earlier cloning of the information safe. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Link: https://lore.kernel.org/r/20220202160109.108149-12-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 0f8796159379..862564a5df74 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -520,7 +520,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
struct dm_target_io *tio;
struct bio *clone;
- clone = bio_alloc_bioset(NULL, 0, 0, GFP_NOIO, &md->io_bs);
+ clone = bio_clone_fast(bio, GFP_NOIO, &md->io_bs);
tio = clone_to_tio(clone);
tio->inside_dm_io = true;
@@ -553,8 +553,8 @@ static struct bio *alloc_tio(struct clone_info *ci, struct dm_target *ti,
/* the dm_target_io embedded in ci->io is available */
tio = &ci->io->tio;
} else {
- struct bio *clone = bio_alloc_bioset(NULL, 0, 0, gfp_mask,
- &ci->io->md->bs);
+ struct bio *clone = bio_clone_fast(ci->bio, gfp_mask,
+ &ci->io->md->bs);
if (!clone)
return NULL;
@@ -562,12 +562,6 @@ static struct bio *alloc_tio(struct clone_info *ci, struct dm_target *ti,
tio->inside_dm_io = false;
}
- if (__bio_clone_fast(&tio->clone, ci->bio, gfp_mask) < 0) {
- if (ci->io->tio.io)
- bio_put(&tio->clone);
- return NULL;
- }
-
tio->magic = DM_TIO_MAGIC;
tio->io = ci->io;
tio->ti = ti;