public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Kent Overstreet <koverstreet@google.com>
Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
	dm-devel@redhat.com, axboe@kernel.dk, neilb@suse.de
Subject: Re: [PATCH v2 07/26] block: Don't use bi_idx in bio_split() or require it to be 0
Date: Thu, 20 Sep 2012 16:45:44 -0700	[thread overview]
Message-ID: <20120920234544.GN7264@google.com> (raw)
In-Reply-To: <1347322957-25260-8-git-send-email-koverstreet@google.com>

On Mon, Sep 10, 2012 at 05:22:18PM -0700, Kent Overstreet wrote:
> Prep work for immutable bio_vecs/efficient bio splitting: they require
> auditing and removing most uses of bi_idx.
> 
> So here we convert bio_split() to respect the current value of bi_idx
> and use the bio_iovec() macro, instead of assuming bi_idx will be 0.

I find the description a bit cryptic.

> Signed-off-by: Kent Overstreet <koverstreet@google.com>
> CC: Jens Axboe <axboe@kernel.dk>
> ---
>  drivers/block/drbd/drbd_req.c | 6 +++---
>  drivers/md/raid0.c            | 3 +--
>  drivers/md/raid10.c           | 3 +--
>  fs/bio-integrity.c            | 4 ++--
>  fs/bio.c                      | 7 +++----
>  5 files changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
> index af69a96..57eb253 100644
> --- a/drivers/block/drbd/drbd_req.c
> +++ b/drivers/block/drbd/drbd_req.c
> @@ -1155,11 +1155,11 @@ void drbd_make_request(struct request_queue *q, struct bio *bio)
>  
>  	/* can this bio be split generically?
>  	 * Maybe add our own split-arbitrary-bios function. */
> -	if (bio->bi_vcnt != 1 || bio->bi_idx != 0 || bio->bi_size > DRBD_MAX_BIO_SIZE) {
> +	if (bio_segments(bio) != 1 || bio->bi_size > DRBD_MAX_BIO_SIZE) {
>  		/* rather error out here than BUG in bio_split */
>  		dev_err(DEV, "bio would need to, but cannot, be split: "
> -		    "(vcnt=%u,idx=%u,size=%u,sector=%llu)\n",
> -		    bio->bi_vcnt, bio->bi_idx, bio->bi_size,
> +		    "(segments=%u,size=%u,sector=%llu)\n",
> +		    bio_segments(bio), bio->bi_size,
>  		    (unsigned long long)bio->bi_sector);
>  		bio_endio(bio, -EINVAL);
>  	} else {
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index 387cb89..0587450 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -509,8 +509,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio)
>  		sector_t sector = bio->bi_sector;
>  		struct bio_pair *bp;
>  		/* Sanity check -- queue functions should prevent this happening */
> -		if (bio->bi_vcnt != 1 ||
> -		    bio->bi_idx != 0)
> +		if (bio_segments(bio) != 1)
>  			goto bad_map;
>  		/* This is a one page bio that upper layers
>  		 * refuse to split for us, so we need to split it.
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 9715aaf..bbd08f5 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -1081,8 +1081,7 @@ static void make_request(struct mddev *mddev, struct bio * bio)
>  			 || conf->prev.near_copies < conf->prev.raid_disks))) {
>  		struct bio_pair *bp;
>  		/* Sanity check -- queue functions should prevent this happening */
> -		if (bio->bi_vcnt != 1 ||
> -		    bio->bi_idx != 0)
> +		if (bio_segments(bio) != 1)
>  			goto bad_map;
>  		/* This is a one page bio that upper layers
>  		 * refuse to split for us, so we need to split it.

And wonder how the description applies to the above.

> --- a/fs/bio.c
> +++ b/fs/bio.c
> @@ -1616,8 +1616,7 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)
>  	trace_block_split(bdev_get_queue(bi->bi_bdev), bi,
>  				bi->bi_sector + first_sectors);
>  
> -	BUG_ON(bi->bi_vcnt != 1);
> -	BUG_ON(bi->bi_idx != 0);
> +	BUG_ON(bio_segments(bi) != 1);
>  	atomic_set(&bp->cnt, 3);
>  	bp->error = 0;
>  	bp->bio1 = *bi;
> @@ -1626,8 +1625,8 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)
>  	bp->bio2.bi_size -= first_sectors << 9;
>  	bp->bio1.bi_size = first_sectors << 9;
>  
> -	bp->bv1 = bi->bi_io_vec[0];
> -	bp->bv2 = bi->bi_io_vec[0];
> +	bp->bv1 = *bio_iovec(bi);
> +	bp->bv2 = *bio_iovec(bi);

This conflicts with a recent commit from Martin.  You probably wanna
rebase.

Thanks.

-- 
tejun

  reply	other threads:[~2012-09-20 23:45 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11  0:22 [PATCH v2 00/26] Prep work for immutable bio vecs Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 01/26] block: Convert integrity to bvec_alloc_bs(), and a bugfix Kent Overstreet
2012-09-11 20:36   ` [dm-devel] " Vivek Goyal
2012-09-11 20:48     ` Kent Overstreet
2012-09-11 22:07     ` Kent Overstreet
2012-09-12 19:39       ` Martin K. Petersen
2012-09-17 21:08         ` Kent Overstreet
2012-09-20 21:53   ` Tejun Heo
2012-09-11  0:22 ` [PATCH v2 02/26] block: Add bio_advance() Kent Overstreet
2012-09-20 21:58   ` Tejun Heo
2012-09-20 23:13     ` Kent Overstreet
2012-09-20 23:25       ` Tejun Heo
2012-09-20 23:38         ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 03/26] block: Refactor blk_update_request() Kent Overstreet
2012-09-20 23:20   ` Tejun Heo
2012-09-20 23:36     ` Kent Overstreet
2012-09-20 23:41       ` Tejun Heo
2012-09-20 23:50         ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 04/26] md: Convert md_trim_bio() to use bio_advance() Kent Overstreet
2012-09-20 23:27   ` Tejun Heo
2012-09-11  0:22 ` [PATCH v2 05/26] block: Add bio_end() Kent Overstreet
2012-09-17  9:17   ` Steven Whitehouse
2012-09-20 23:32   ` Tejun Heo
2012-09-20 23:44     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 06/26] block: Use bio_sectors() more consistently Kent Overstreet
2012-09-20 23:36   ` Tejun Heo
2012-09-20 23:47     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 07/26] block: Don't use bi_idx in bio_split() or require it to be 0 Kent Overstreet
2012-09-20 23:45   ` Tejun Heo [this message]
2012-09-21  0:00     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 08/26] block: Remove bi_idx references Kent Overstreet
2012-09-20 23:49   ` Tejun Heo
2012-09-21  0:04     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 09/26] block: Remove some unnecessary bi_vcnt usage Kent Overstreet
2012-09-20 23:51   ` Tejun Heo
2012-09-11  0:22 ` [PATCH v2 10/26] block: Add submit_bio_wait(), remove from md Kent Overstreet
2012-09-20 23:56   ` Tejun Heo
2012-09-21  0:06     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 11/26] raid10: Use bio_reset() Kent Overstreet
2012-09-20 23:59   ` Tejun Heo
2012-09-11  0:22 ` [PATCH v2 12/26] raid1: use bio_reset() Kent Overstreet
2012-09-11  4:59   ` NeilBrown
2012-09-11 18:28     ` Kent Overstreet
2012-09-11 21:17       ` NeilBrown
2012-09-11  0:22 ` [PATCH v2 13/26] raid5: " Kent Overstreet
2012-09-11  5:03   ` NeilBrown
2012-09-11 19:26     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 14/26] raid1: Refactor narrow_write_error() to not use bi_idx Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 15/26] block: Add bio_copy_data() Kent Overstreet
2012-09-21  0:06   ` Tejun Heo
2012-09-21  0:09     ` Kent Overstreet
2012-09-21  0:15       ` Tejun Heo
2012-09-21  0:09     ` Tejun Heo
2012-09-21  0:13       ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 16/26] pktcdvd: use bio_copy_data() Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 17/26] pktcdvd: Use bio_reset() in disabled code to kill bi_idx usage Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 18/26] raid1: use bio_copy_data() Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 19/26] bounce: Refactor __blk_queue_bounce to not use bi_io_vec Kent Overstreet
2012-09-21  0:25   ` Tejun Heo
2012-09-21  0:29     ` Kent Overstreet
2012-09-21  0:27   ` Tejun Heo
2012-09-21  0:34     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 20/26] block: Add bio_for_each_segment_all() Kent Overstreet
2012-09-21  0:35   ` Tejun Heo
2012-09-11  0:22 ` [PATCH v2 21/26] block: Convert some code to bio_for_each_segment_all() Kent Overstreet
2012-09-21  0:38   ` Tejun Heo
2012-09-21  0:50     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 22/26] block: Add bio_alloc_pages() Kent Overstreet
2012-09-21  0:47   ` Tejun Heo
2012-09-21  4:50     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 23/26] raid1: use bio_alloc_pages() Kent Overstreet
2012-09-21  0:48   ` Tejun Heo
2012-09-21  4:51     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 24/26] block: Add an explicit bio flag for bios that own their bvec Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 25/26] bio-integrity: Add explicit field for owner of bip_buf Kent Overstreet
2012-09-12 19:41   ` Martin K. Petersen
2012-09-17 21:09     ` Kent Overstreet
2012-09-11  0:22 ` [PATCH v2 26/26] block: Add BIO_SUBMITTED flag, kill BIO_CLONED Kent Overstreet
2012-09-11  5:22 ` [PATCH v2 00/26] Prep work for immutable bio vecs NeilBrown
2012-09-20 23:22 ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2012-10-15 20:08 [PATCH v4 00/24] " Kent Overstreet
2012-10-15 20:09 ` [PATCH v2 07/26] block: Don't use bi_idx in bio_split() or require it to be 0 Kent Overstreet

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=20120920234544.GN7264@google.com \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=koverstreet@google.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox