Re: dm: stop using bi_private

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 04 2014 at  6:24pm -0500,
Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:

> Device mapper uses the bi_private field as a pointer to dm_target_io or 
> dm_rq_clone_bio_info. With current kernel, the bio structure is embedded 
> in the structures dm_target_io and dm_rq_clone_bio_info, so the pointer to 
> the structure that contains the bio can be found with the macro 
> container_of.
> 
> This patch removes the use of bi_private and uses container_of instead.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> 
> ---
>  drivers/md/dm.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> Index: linux-3.14-rc4/drivers/md/dm.c
> ===================================================================
> --- linux-3.14-rc4.orig/drivers/md/dm.c	2014-03-01 17:19:05.000000000 +0100
> +++ linux-3.14-rc4/drivers/md/dm.c	2014-03-01 17:23:31.000000000 +0100
> @@ -753,7 +753,7 @@ static void dec_pending(struct dm_io *io
>  static void clone_endio(struct bio *bio, int error)
>  {
>  	int r = 0;
> -	struct dm_target_io *tio = bio->bi_private;
> +	struct dm_target_io *tio = dm_per_bio_data(bio, 0);
>  	struct dm_io *io = tio->io;
>  	struct mapped_device *md = tio->io->md;
>  	dm_endio_fn endio = tio->ti->type->end_io;

FYI, I've picked this up for 3.15.

But I decided to use this instead:
  struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);

While I understand dm_per_bio_data() with 0 accomplishes the same I
think it clearer to use container_of().

Mike

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux