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>
struct dm_target_io *tio;
struct bio *clone;
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;
tio = clone_to_tio(clone);
tio->inside_dm_io = true;
/* the dm_target_io embedded in ci->io is available */
tio = &ci->io->tio;
} else {
/* 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);
tio->inside_dm_io = false;
}
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;
tio->magic = DM_TIO_MAGIC;
tio->io = ci->io;
tio->ti = ti;