Commit ba6cf074 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: remove extra loop from copy_data

copy_data currently loops over bio's in a list, but the caller also does the
same looping, sometimes with extra work.  So remove the loop from copy_data.
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3f67a059
...@@ -612,11 +612,10 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i) ...@@ -612,11 +612,10 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i)
/* /*
* Copy data between a page in the stripe cache, and one or more bion * Copy data between a page in the stripe cache, and a bio.
* The page could align with the middle of the bio, or there could be * There are no alignment or size guarantees between the page or the
* several bion, each with several bio_vecs, which cover part of the page * bio except that there is some overlap.
* Multiple bion are linked together on bi_next. There may be extras * All iovecs in the bio must be considered.
* at the end of this list. We ignore them.
*/ */
static void copy_data(int frombio, struct bio *bio, static void copy_data(int frombio, struct bio *bio,
struct page *page, struct page *page,
...@@ -625,10 +624,8 @@ static void copy_data(int frombio, struct bio *bio, ...@@ -625,10 +624,8 @@ static void copy_data(int frombio, struct bio *bio,
char *pa = page_address(page); char *pa = page_address(page);
struct bio_vec *bvl; struct bio_vec *bvl;
int i; int i;
for (;bio && bio->bi_sector < sector+STRIPE_SECTORS;
bio = r5_next_bio(bio, sector) ) {
int page_offset; int page_offset;
if (bio->bi_sector >= sector) if (bio->bi_sector >= sector)
page_offset = (signed)(bio->bi_sector - sector) * 512; page_offset = (signed)(bio->bi_sector - sector) * 512;
else else
...@@ -660,7 +657,6 @@ static void copy_data(int frombio, struct bio *bio, ...@@ -660,7 +657,6 @@ static void copy_data(int frombio, struct bio *bio,
break; break;
page_offset += len; page_offset += len;
} }
}
} }
#define check_xor() do { \ #define check_xor() do { \
......
...@@ -670,10 +670,8 @@ static void copy_data(int frombio, struct bio *bio, ...@@ -670,10 +670,8 @@ static void copy_data(int frombio, struct bio *bio,
char *pa = page_address(page); char *pa = page_address(page);
struct bio_vec *bvl; struct bio_vec *bvl;
int i; int i;
for (;bio && bio->bi_sector < sector+STRIPE_SECTORS;
bio = r5_next_bio(bio, sector) ) {
int page_offset; int page_offset;
if (bio->bi_sector >= sector) if (bio->bi_sector >= sector)
page_offset = (signed)(bio->bi_sector - sector) * 512; page_offset = (signed)(bio->bi_sector - sector) * 512;
else else
...@@ -705,7 +703,6 @@ static void copy_data(int frombio, struct bio *bio, ...@@ -705,7 +703,6 @@ static void copy_data(int frombio, struct bio *bio,
break; break;
page_offset += len; page_offset += len;
} }
}
} }
#define check_xor() do { \ #define check_xor() do { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment