All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, "Alasdair G. Kergon" <agk@redhat.com>
Subject: Re: dm: stop using bi_private
Date: Wed, 12 Mar 2014 16:56:18 -0400	[thread overview]
Message-ID: <20140312205618.GA4784@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1403041721520.29476@file01.intranet.prod.int.rdu2.redhat.com>

On Tue, Mar 04 2014 at  6:24pm -0500,
Mikulas Patocka <mpatocka@redhat.com> 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@redhat.com>
> 
> ---
>  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

      reply	other threads:[~2014-03-12 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 23:24 [PATCH] dm: stop using bi_private Mikulas Patocka
2014-03-12 20:56 ` Mike Snitzer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140312205618.GA4784@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.