Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm: stop using bi_private

Device mapper uses the bio structure's bi_private field as a pointer
to dm_target_io or dm_rq_clone_bio_info. But a bio structure is
embedded in the dm_target_io and dm_rq_clone_bio_info structures, so the
pointer to the structure that contains the bio can be found with the
container_of() macro.

Remove the use of bi_private and use container_of() instead.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Mikulas Patocka and committed by
Mike Snitzer
bfc6d41c d70ab4fb

+3 -4
+3 -4
drivers/md/dm.c
··· 753 753 static void clone_endio(struct bio *bio, int error) 754 754 { 755 755 int r = 0; 756 - struct dm_target_io *tio = bio->bi_private; 756 + struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); 757 757 struct dm_io *io = tio->io; 758 758 struct mapped_device *md = tio->io->md; 759 759 dm_endio_fn endio = tio->ti->type->end_io; ··· 787 787 */ 788 788 static void end_clone_bio(struct bio *clone, int error) 789 789 { 790 - struct dm_rq_clone_bio_info *info = clone->bi_private; 790 + struct dm_rq_clone_bio_info *info = 791 + container_of(clone, struct dm_rq_clone_bio_info, clone); 791 792 struct dm_rq_target_io *tio = info->tio; 792 793 struct bio *bio = info->orig; 793 794 unsigned int nr_bytes = info->orig->bi_iter.bi_size; ··· 1114 1113 struct dm_target *ti = tio->ti; 1115 1114 1116 1115 clone->bi_end_io = clone_endio; 1117 - clone->bi_private = tio; 1118 1116 1119 1117 /* 1120 1118 * Map the clone. If r == 0 we don't need to do ··· 1522 1522 info->orig = bio_orig; 1523 1523 info->tio = tio; 1524 1524 bio->bi_end_io = end_clone_bio; 1525 - bio->bi_private = info; 1526 1525 1527 1526 return 0; 1528 1527 }