From: Kent Overstreet <koverstreet@google.com>
To: axboe@kernel.dk, tytso@mit.edu, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Cc: Kent Overstreet <koverstreet@google.com>,
Jiri Kosina <jkosina@suse.cz>,
Asai Thambi S P <asamymuthupa@micron.com>
Subject: [PATCH 21/26] block: Move bouncing to generic_make_request()
Date: Sat, 8 Jun 2013 19:19:03 -0700 [thread overview]
Message-ID: <1370744348-15407-22-git-send-email-koverstreet@google.com> (raw)
In-Reply-To: <1370744348-15407-1-git-send-email-koverstreet@google.com>
Next patch is going to make generic_make_request() handle arbitrary
sized bios by splitting them if necessary. It makes more sense to call
blk_queue_bounce() first, before the bios have been fragmented.
Also, __blk_recalc_rq_segments() now doesn't have to take into account
potential bouncing - it's already been done.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
---
block/blk-core.c | 14 +++++++-------
block/blk-merge.c | 15 ++++-----------
drivers/block/mtip32xx/mtip32xx.c | 2 --
drivers/block/pktcdvd.c | 2 --
4 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 0704c5c..4d6eb60 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1470,13 +1470,6 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio)
struct request *req;
unsigned int request_count = 0;
- /*
- * low level driver can indicate that it wants pages above a
- * certain limit bounced to low memory (ie for highmem, or even
- * ISA dma in theory)
- */
- blk_queue_bounce(q, &bio);
-
if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) {
bio_endio(bio, -EIO);
return;
@@ -1828,6 +1821,13 @@ void generic_make_request(struct bio *bio)
do {
struct request_queue *q = bdev_get_queue(bio->bi_bdev);
+ /*
+ * low level driver can indicate that it wants pages above a
+ * certain limit bounced to low memory (ie for highmem, or even
+ * ISA dma in theory)
+ */
+ blk_queue_bounce(q, &bio);
+
q->make_request_fn(q, bio);
bio = bio_list_pop(current->bio_list);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index b53ddac..ba48830 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -13,7 +13,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
struct bio *bio)
{
struct bio_vec bv, bvprv;
- int cluster, high, highprv = 1;
+ int cluster, prev = 0;
unsigned int seg_size, nr_phys_segs;
struct bio *fbio, *bbio;
struct bvec_iter iter;
@@ -27,15 +27,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
nr_phys_segs = 0;
for_each_bio(bio) {
bio_for_each_segment(bv, bio, iter) {
- /*
- * the trick here is making sure that a high page is
- * never considered part of another segment, since that
- * might change with the bounce page.
- */
- high = page_to_pfn(bv.bv_page) > queue_bounce_pfn(q);
- if (high || highprv)
- goto new_segment;
- if (cluster) {
+ if (prev && cluster) {
if (seg_size + bv.bv_len
> queue_max_segment_size(q))
goto new_segment;
@@ -46,6 +38,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
seg_size += bv.bv_len;
bvprv = bv;
+ prev = 1;
continue;
}
new_segment:
@@ -55,8 +48,8 @@ new_segment:
nr_phys_segs++;
bvprv = bv;
+ prev = 1;
seg_size = bv.bv_len;
- highprv = high;
}
bbio = bio;
}
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 9fd1751..089cda3 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3912,8 +3912,6 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio)
sg = mtip_hw_get_scatterlist(dd, &tag, unaligned);
if (likely(sg != NULL)) {
- blk_queue_bounce(queue, &bio);
-
if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) {
dev_warn(&dd->pdev->dev,
"Maximum number of SGL entries exceeded\n");
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a929817..3f6ad2b 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2486,8 +2486,6 @@ static void pkt_make_request(struct request_queue *q, struct bio *bio)
goto end_io;
}
- blk_queue_bounce(q, &bio);
-
do {
sector_t zone = ZONE(bio->bi_iter.bi_sector, pd);
sector_t last_zone = ZONE(bio_end_sector(bio) - 1, pd);
--
1.8.3.rc1
next prev parent reply other threads:[~2013-06-09 2:20 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-09 2:18 Immutable biovecs, dio rewrite Kent Overstreet
2013-06-09 2:18 ` [PATCH 01/26] bcache: Use standard utility code Kent Overstreet
2013-06-09 2:18 ` [PATCH 02/26] bcache: Kill unaligned bvec hack Kent Overstreet
2013-06-09 2:18 ` [PATCH 03/26] block: Abstract out bvec iterator Kent Overstreet
2013-06-09 2:18 ` [PATCH 04/26] dm: Use bvec_iter for dm_bio_record() Kent Overstreet
2013-06-09 2:18 ` [PATCH 05/26] block: Convert bio_iovec() to bvec_iter Kent Overstreet
2013-06-09 2:18 ` [PATCH 07/26] block: Immutable bio vecs Kent Overstreet
2013-06-09 2:18 ` [PATCH 08/26] block: Convert bio_copy_data() to bvec_iter Kent Overstreet
2013-06-09 2:18 ` [PATCH 09/26] bio-integrity: Convert " Kent Overstreet
2013-06-09 2:18 ` [PATCH 10/26] block: Convert drivers to immutable biovecs Kent Overstreet
2013-06-28 19:39 ` Ed Cashin
2013-06-09 2:18 ` [PATCH 11/26] block: Kill bio_iovec_idx(), __bio_iovec() Kent Overstreet
2013-06-09 2:18 ` [PATCH 12/26] rbd: Refactor bio cloning, don't clone biovecs Kent Overstreet
2013-06-09 2:18 ` [PATCH 13/26] dm: Refactor for new bio cloning/splitting Kent Overstreet
2013-06-09 2:18 ` [PATCH 14/26] md, bcache: Remove bi_idx hacks Kent Overstreet
2013-06-09 2:18 ` [PATCH 15/26] block: Generic bio chaining Kent Overstreet
2013-06-09 2:18 ` [PATCH 16/26] block: Rename bio_split() -> bio_pair_split() Kent Overstreet
2013-06-09 2:18 ` [PATCH 17/26] block: Introduce new bio_split() Kent Overstreet
2013-06-09 2:19 ` [PATCH 18/26] block: Kill bio_pair_split() Kent Overstreet
2013-06-09 2:19 ` [PATCH 19/26] block: Kill bio_segments() Kent Overstreet
2013-06-09 2:19 ` [PATCH 20/26] block: Don't save/copy bvec array anymore, share when cloning Kent Overstreet
2013-06-09 2:19 ` Kent Overstreet [this message]
2013-06-09 2:19 ` [PATCH 22/26] block: Make generic_make_request handle arbitrary sized bios Kent Overstreet
2013-06-11 17:12 ` David Sterba
2013-06-12 4:26 ` Kent Overstreet
2013-06-09 2:19 ` [PATCH 23/26] blk-lib.c: generic_make_request() handles large bios now Kent Overstreet
2013-06-09 2:19 ` [PATCH 24/26] bcache: " Kent Overstreet
2013-06-09 2:19 ` [PATCH 25/26] block: Add bio_get_user_pages() Kent Overstreet
2013-06-09 2:19 ` [PATCH 26/26] Apply fire to dio code Kent Overstreet
2013-06-09 8:34 ` Immutable biovecs, dio rewrite Geert Uytterhoeven
2013-06-09 8:55 ` Kent Overstreet
[not found] ` <1370744348-15407-7-git-send-email-koverstreet@google.com>
2013-06-09 14:21 ` [PATCH 06/26] block: Convert bio_for_each_segment() to bvec_iter Geoff Levand
2013-06-11 5:20 ` Immutable biovecs, dio rewrite Dave Chinner
2013-06-12 20:30 ` 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=1370744348-15407-22-git-send-email-koverstreet@google.com \
--to=koverstreet@google.com \
--cc=asamymuthupa@micron.com \
--cc=axboe@kernel.dk \
--cc=jkosina@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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