@@ -200,6 +200,22 @@ struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask,
}
EXPORT_SYMBOL_GPL(bio_clone_mddev);
+struct bio *bio_clone_slow_mddev_partial(struct bio *bio, gfp_t gfp_mask,
+ struct mddev *mddev, int offset,
+ int size)
+{
+ struct bio_set *bs;
+
+ if (!mddev || !mddev->bio_set)
+ bs = fs_bio_set;
+ else
+ bs = mddev->bio_set;
+
+ return bio_clone_bioset_partial(bio, gfp_mask, bs, offset << 9,
+ size << 9);
+}
+EXPORT_SYMBOL_GPL(bio_clone_slow_mddev_partial);
+
/*
* We have a system wide 'event count' that is incremented
* on any 'interesting' event, and readers of /proc/mdstat
@@ -675,6 +675,9 @@ extern void mddev_suspend(struct mddev *mddev);
extern void mddev_resume(struct mddev *mddev);
extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask,
struct mddev *mddev);
+extern struct bio *bio_clone_slow_mddev_partial(struct bio *bio, gfp_t gfp_mask,
+ struct mddev *mddev, int offset,
+ int size);
extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
struct mddev *mddev);
In raid1/raid10, most users of bio_clone_mddev() need bio_trim() too, that means only part of the bio is required to be cloned, and not necessary to clone the whole bio each time, and it is just enough to clone the specified bvecs range. So this patch introduces bio_clone_slow_mddev_partial() to improve the situation, and it is named as slow because the following patch will switch to bio_clone_fast() in bio_clone_mddev(). Signed-off-by: Ming Lei <tom.leiming@gmail.com> --- drivers/md/md.c | 16 ++++++++++++++++ drivers/md/md.h | 3 +++ 2 files changed, 19 insertions(+)