linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: device-mapper development <dm-devel@redhat.com>
Cc: Kent Overstreet <kmo@daterainc.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-btrfs@vger.kernel.org, axboe@kernel.dk, hch@infradead.org,
	Alasdair Kergon <agk@redhat.com>
Subject: Re: [dm-devel] [PATCH 4/9] block: Make generic_make_request handle arbitrary sized bios
Date: Mon, 04 Nov 2013 15:56:52 -0800	[thread overview]
Message-ID: <52783444.8070309@cs.wisc.edu> (raw)
In-Reply-To: <1383608187-27368-5-git-send-email-kmo@daterainc.com>

On 11/04/2013 03:36 PM, Kent Overstreet wrote:
> @@ -1822,6 +1820,14 @@ void generic_make_request(struct bio *bio)
>  		 */
>  		blk_queue_bounce(q, &bio);
>  
> +		if (!blk_queue_largebios(q))
> +			split = blk_bio_segment_split(q, bio, q->bio_split);


Is it assumed bios coming down this path are created using bio_add_page?
If not, does blk_bio_segment_split need a queue_max_sectors or
queue_max_hw_sectors check? I only saw a segment count check below.


> +
> +struct bio *blk_bio_segment_split(struct request_queue *q, struct bio *bio,
> +				  struct bio_set *bs)
> +{
> +	struct bio *split;
> +	struct bio_vec bv, bvprv;
> +	struct bvec_iter iter;
> +	unsigned seg_size = 0, nsegs = 0;
> +	int prev = 0;
> +
> +	struct bvec_merge_data bvm = {
> +		.bi_bdev	= bio->bi_bdev,
> +		.bi_sector	= bio->bi_iter.bi_sector,
> +		.bi_size	= 0,
> +		.bi_rw		= bio->bi_rw,
> +	};
> +
> +	if (bio->bi_rw & REQ_DISCARD)
> +		return blk_bio_discard_split(q, bio, bs);
> +
> +	if (bio->bi_rw & REQ_WRITE_SAME)
> +		return blk_bio_write_same_split(q, bio, bs);
> +
> +	bio_for_each_segment(bv, bio, iter) {
> +		if (q->merge_bvec_fn &&
> +		    q->merge_bvec_fn(q, &bvm, &bv) < (int) bv.bv_len)
> +			goto split;
> +
> +		bvm.bi_size += bv.bv_len;
> +
> +		if (prev && blk_queue_cluster(q)) {
> +			if (seg_size + bv.bv_len > queue_max_segment_size(q))
> +				goto new_segment;
> +			if (!BIOVEC_PHYS_MERGEABLE(&bvprv, &bv))
> +				goto new_segment;
> +			if (!BIOVEC_SEG_BOUNDARY(q, &bvprv, &bv))
> +				goto new_segment;
> +
> +			seg_size += bv.bv_len;
> +			bvprv = bv;
> +			prev = 1;
> +			continue;
> +		}
> +new_segment:
> +		if (nsegs == queue_max_segments(q))
> +			goto split;
> +
> +		nsegs++;
> +		bvprv = bv;
> +		prev = 1;
> +		seg_size = bv.bv_len;
> +	}
> +
> +	return NULL;
> +split:
> +	split = bio_clone_bioset(bio, GFP_NOIO, bs);
> +
> +	split->bi_iter.bi_size -= iter.bi_size;
> +	bio->bi_iter = iter;
> +
> +	if (bio_integrity(bio)) {
> +		bio_integrity_advance(bio, split->bi_iter.bi_size);
> +		bio_integrity_trim(split, 0, bio_sectors(split));
> +	}
> +
> +	return split;
> +}

  reply	other threads:[~2013-11-05  0:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 23:36 [PATCH] Block layer stuff/DIO rewrite prep for 3.14 Kent Overstreet
2013-11-04 23:36 ` [PATCH 1/9] block: Convert various code to bio_for_each_segment() Kent Overstreet
2013-11-05 13:53   ` Josef Bacik
2013-11-07 11:26   ` Jan Kara
2013-11-07 20:21     ` Kent Overstreet
2013-11-04 23:36 ` [PATCH 2/9] block: submit_bio_wait() conversions Kent Overstreet
2013-11-04 23:36 ` [PATCH 3/9] block: Move bouncing to generic_make_request() Kent Overstreet
2013-11-04 23:36 ` [PATCH 4/9] block: Make generic_make_request handle arbitrary sized bios Kent Overstreet
2013-11-04 23:56   ` Mike Christie [this message]
2013-11-05  0:55     ` [dm-devel] " Kent Overstreet
2013-11-04 23:36 ` [PATCH 5/9] block: Gut bio_add_page(), kill bio_add_pc_page() Kent Overstreet
2013-11-04 23:36 ` [PATCH 6/9] mtip32xx: handle arbitrary size bios Kent Overstreet
2013-11-05 13:49   ` Josef Bacik
2013-11-04 23:36 ` [PATCH 7/9] blk-lib.c: generic_make_request() handles large bios now Kent Overstreet
2013-11-04 23:36 ` [PATCH 8/9] bcache: " Kent Overstreet
2013-11-04 23:36 ` [PATCH 9/9] block: Add bio_get_user_pages() 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=52783444.8070309@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=kmo@daterainc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).