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)
/*
* Copy data between a page in the stripe cache, and one or more bion
* The page could align with the middle of the bio, or there could be
* several bion, each with several bio_vecs, which cover part of the page
* Multiple bion are linked together on bi_next. There may be extras
* at the end of this list. We ignore them.
* Copy data between a page in the stripe cache, and a bio.
* There are no alignment or size guarantees between the page or the
* bio except that there is some overlap.
* All iovecs in the bio must be considered.
*/
static void copy_data(int frombio, struct bio *bio,
struct page *page,
......@@ -625,10 +624,8 @@ static void copy_data(int frombio, struct bio *bio,
char *pa = page_address(page);
struct bio_vec *bvl;
int i;
for (;bio && bio->bi_sector < sector+STRIPE_SECTORS;
bio = r5_next_bio(bio, sector) ) {
int page_offset;
if (bio->bi_sector >= sector)
page_offset = (signed)(bio->bi_sector - sector) * 512;
else
......@@ -660,7 +657,6 @@ static void copy_data(int frombio, struct bio *bio,
break;
page_offset += len;
}
}
}
#define check_xor() do { \
......
......@@ -670,10 +670,8 @@ static void copy_data(int frombio, struct bio *bio,
char *pa = page_address(page);
struct bio_vec *bvl;
int i;
for (;bio && bio->bi_sector < sector+STRIPE_SECTORS;
bio = r5_next_bio(bio, sector) ) {
int page_offset;
if (bio->bi_sector >= sector)
page_offset = (signed)(bio->bi_sector - sector) * 512;
else
......@@ -705,7 +703,6 @@ static void copy_data(int frombio, struct bio *bio,
break;
page_offset += len;
}
}
}
#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