Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587743

[PATCH v1 14/14] md: raid10: avoid direct access to bvec table in handle_reshape_read_error

From Ming Lei <tom.leiming@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v1 14/14] md: raid10: avoid direct access to bvec table in handle_reshape_read_error
Date 2017-02-24 16:50 +0100
Message-ID <teqi7-2bp-49@gated-at.bofh.it> (permalink)
References <teqi5-2bp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The cost is 128bytes(8*16) stack space in kernel thread context, and
just use the bio helper to retrieve pages from bio.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/md/raid10.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index ae162d542bf4..705cb9af03ef 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4689,7 +4689,15 @@ static int handle_reshape_read_error(struct mddev *mddev,
 	struct r10bio *r10b = &on_stack.r10_bio;
 	int slot = 0;
 	int idx = 0;
-	struct bio_vec *bvec = r10_bio->master_bio->bi_io_vec;
+	struct bio_vec *bvl;
+	struct page *pages[RESYNC_PAGES];
+
+	/*
+	 * This bio is allocated in reshape_request(), and size
+	 * is still RESYNC_PAGES
+	 */
+	bio_for_each_segment_all(bvl, r10_bio->master_bio, idx)
+		pages[idx] = bvl->bv_page;
 
 	r10b->sector = r10_bio->sector;
 	__raid10_find_phys(&conf->prev, r10b);
@@ -4718,7 +4726,7 @@ static int handle_reshape_read_error(struct mddev *mddev,
 			success = sync_page_io(rdev,
 					       addr,
 					       s << 9,
-					       bvec[idx].bv_page,
+					       pages[idx],
 					       REQ_OP_READ, 0, false);
 			rdev_dec_pending(rdev, mddev);
 			rcu_read_lock();
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 00/14] md: cleanup on direct access to bvec table Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 06/14] md: raid1: simplify r1buf_pool_free() Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 04/14] md: move two macros into md.h Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 08/14] md: raid1: retrieve page from pre-allocated resync page array Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 13/14] md: raid10: retrieve page from preallocated resync page array Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 14/14] md: raid10: avoid direct access to bvec table in handle_reshape_read_error Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 03/14] md: raid1/raid10: use bio_remove_last_page() Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
  [PATCH v1 01/14] block: introduce bio_segments_all() Ming Lei <tom.leiming@gmail.com> - 2017-02-24 16:50 +0100
    Re: [PATCH v1 01/14] block: introduce bio_segments_all() Christoph Hellwig <hch@infradead.org> - 2017-02-25 19:30 +0100
      Re: [PATCH v1 01/14] block: introduce bio_segments_all() Ming Lei <tom.leiming@gmail.com> - 2017-02-28 13:30 +0100

csiph-web