From: Arnd Bergmann <arnd@arndb.de>
To: Shaohua Li <shli@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, NeilBrown <neilb@suse.com>,
Ming Lei <tom.leiming@gmail.com>, Jens Axboe <axboe@fb.com>,
"colyli@suse.de" <colyli@suse.de>,
Guoqing Jiang <gqjiang@suse.com>,
Mike Christie <mchristi@redhat.com>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Revert "md: raid1: use bio helper in process_checks()"
Date: Tue, 28 Mar 2017 11:49:57 +0200 [thread overview]
Message-ID: <20170328095029.3500369-1-arnd@arndb.de> (raw)
Commit 60928a91b0b3 ("md: raid1: use bio helper in process_checks()")
is probably correct, but I get a new compile-time warning after
it, and have trouble understanding what it fixes:
drivers/md/raid1.c: In function 'sync_request_write':
drivers/md/raid1.c:2172:9: error: 'page_len$' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (memcmp(page_address(ppages[j]),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
page_address(spages[j]),
~~~~~~~~~~~~~~~~~~~~~~~~
page_len[j]))
~~~~~~~~~~~~
drivers/md/raid1.c:2160:7: note: 'page_len$' was declared here
int page_len[RESYNC_PAGES];
^~~~~~~~
This reverts it to resolve the warning.
Fixes: 60928a91b0b3 ("md: raid1: use bio helper in process_checks()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/md/raid1.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index b7d9651286d4..4d176c8abc33 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2113,7 +2113,6 @@ static void process_checks(struct r1bio *r1_bio)
int j;
int size;
int error;
- struct bio_vec *bi;
struct bio *b = r1_bio->bios[i];
struct resync_pages *rp = get_resync_pages(b);
if (b->bi_end_io != end_sync_read)
@@ -2132,7 +2131,9 @@ static void process_checks(struct r1bio *r1_bio)
b->bi_private = rp;
size = b->bi_iter.bi_size;
- bio_for_each_segment_all(bi, b, j) {
+ for (j = 0; j < vcnt ; j++) {
+ struct bio_vec *bi;
+ bi = &b->bi_io_vec[j];
bi->bv_offset = 0;
if (size > PAGE_SIZE)
bi->bv_len = PAGE_SIZE;
@@ -2156,22 +2157,17 @@ static void process_checks(struct r1bio *r1_bio)
int error = sbio->bi_error;
struct page **ppages = get_resync_pages(pbio)->pages;
struct page **spages = get_resync_pages(sbio)->pages;
- struct bio_vec *bi;
- int page_len[RESYNC_PAGES];
if (sbio->bi_end_io != end_sync_read)
continue;
/* Now we can 'fixup' the error value */
sbio->bi_error = 0;
- bio_for_each_segment_all(bi, sbio, j)
- page_len[j] = bi->bv_len;
-
if (!error) {
for (j = vcnt; j-- ; ) {
if (memcmp(page_address(ppages[j]),
page_address(spages[j]),
- page_len[j]))
+ sbio->bi_io_vec[j].bv_len))
break;
}
} else
--
2.9.0
next reply other threads:[~2017-03-28 9:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 9:49 Arnd Bergmann [this message]
2017-03-28 10:44 ` Ming Lei
2017-03-28 11:35 ` Arnd Bergmann
2017-03-28 11:42 ` Ming Lei
2017-03-28 13:20 ` Arnd Bergmann
2017-03-28 15:02 ` Ming Lei
2017-03-28 15:37 ` Arnd Bergmann
2017-03-28 16:13 ` Ming Lei
2017-03-28 15:43 ` Wols Lists
2017-04-01 21:51 ` Henrique de Moraes Holschuh
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=20170328095029.3500369-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=axboe@fb.com \
--cc=colyli@suse.de \
--cc=gqjiang@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mchristi@redhat.com \
--cc=neilb@suse.com \
--cc=shli@kernel.org \
--cc=tom.leiming@gmail.com \
/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
all inboxes | Powered by JetHome®