[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1482854250-13481-24-git-send-email-tom.leiming@gmail.com>
Date: Tue, 27 Dec 2016 23:56:12 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Jens Axboe <axboe@...com>, linux-kernel@...r.kernel.org
Cc: linux-block@...r.kernel.org, Christoph Hellwig <hch@...radead.org>,
Ming Lei <tom.leiming@...il.com>,
Kent Overstreet <kent.overstreet@...il.com>,
Shaohua Li <shli@...nel.org>,
Mike Christie <mchristi@...hat.com>,
Guoqing Jiang <gqjiang@...e.com>,
linux-bcache@...r.kernel.org (open list:BCACHE (BLOCK LAYER CACHE)),
linux-raid@...r.kernel.org (open list:SOFTWARE RAID (Multiple Disks)
SUPPORT)
Subject: [PATCH v1 23/54] bcache: handle bio_clone() & bvec updating for multipage bvecs
The incoming bio may be too big to be cloned into
one singlepage bvecs bio, so split the bio and
check the splitted bio one by one.
Signed-off-by: Ming Lei <tom.leiming@...il.com>
---
drivers/md/bcache/debug.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
index 48d03e8b3385..18b2d2d138e3 100644
--- a/drivers/md/bcache/debug.c
+++ b/drivers/md/bcache/debug.c
@@ -103,7 +103,7 @@ void bch_btree_verify(struct btree *b)
up(&b->io_mutex);
}
-void bch_data_verify(struct cached_dev *dc, struct bio *bio)
+static void __bch_data_verify(struct cached_dev *dc, struct bio *bio)
{
char name[BDEVNAME_SIZE];
struct bio *check;
@@ -116,7 +116,7 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
* in the new cloned bio because each single page need
* to assign to each bvec of the new bio.
*/
- check = bio_clone(bio, GFP_NOIO);
+ check = bio_clone_sp(bio, GFP_NOIO);
if (!check)
return;
check->bi_opf = REQ_OP_READ;
@@ -151,6 +151,26 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
bio_put(check);
}
+void bch_data_verify(struct cached_dev *dc, struct bio *bio)
+{
+ struct request_queue *q = bdev_get_queue(bio->bi_bdev);
+ struct bio *clone = bio_clone_fast(bio, GFP_NOIO, q->bio_split);
+ unsigned sectors;
+
+ while (!bio_can_convert_to_sp(clone, §ors)) {
+ struct bio *split = bio_split(clone, sectors,
+ GFP_NOIO, q->bio_split);
+
+ __bch_data_verify(dc, split);
+ bio_put(split);
+ }
+
+ if (bio_sectors(clone))
+ __bch_data_verify(dc, clone);
+
+ bio_put(clone);
+}
+
#endif
#ifdef CONFIG_DEBUG_FS
--
2.7.4
Powered by blists - more mailing lists