summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1-10.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2017-07-14 10:14:43 +0200
committerShaohua Li <shli@fb.com>2017-07-21 21:47:20 +0200
commitfb0eb5df09307603b21845af1d143cc910154593 (patch)
tree7415f28242bf25b9351bde3ea2bd7fcadede3392 /drivers/md/raid1-10.c
parentmd: remove 'idx' from 'struct resync_pages' (diff)
downloadlinux-fb0eb5df09307603b21845af1d143cc910154593.tar.xz
linux-fb0eb5df09307603b21845af1d143cc910154593.zip
md: raid1/raid10: initialize bvec table via bio_add_page()
We will support multipage bvec soon, so initialize bvec table using the standardy way instead of writing the talbe directly. Otherwise it won't work any more once multipage bvec is enabled. Acked-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid1-10.c')
-rw-r--r--drivers/md/raid1-10.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
new file mode 100644
index 000000000000..3adb5b9dc4b4
--- /dev/null
+++ b/drivers/md/raid1-10.c
@@ -0,0 +1,19 @@
+/* generally called after bio_reset() for reseting bvec */
+static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
+ int size)
+{
+ int idx = 0;
+
+ /* initialize bvec table again */
+ do {
+ struct page *page = resync_fetch_page(rp, idx);
+ int len = min_t(int, size, PAGE_SIZE);
+
+ /*
+ * won't fail because the vec table is big
+ * enough to hold all these pages
+ */
+ bio_add_page(bio, page, len, 0);
+ size -= len;
+ } while (idx++ < RESYNC_PAGES && size > 0);
+}