|
@@ -2097,11 +2097,17 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
|
|
|
* both 'first' and 'i', so we just compare them.
|
|
|
* All vec entries are PAGE_SIZE;
|
|
|
*/
|
|
|
- for (j = 0; j < vcnt; j++)
|
|
|
+ int sectors = r10_bio->sectors;
|
|
|
+ for (j = 0; j < vcnt; j++) {
|
|
|
+ int len = PAGE_SIZE;
|
|
|
+ if (sectors < (len / 512))
|
|
|
+ len = sectors * 512;
|
|
|
if (memcmp(page_address(fbio->bi_io_vec[j].bv_page),
|
|
|
page_address(tbio->bi_io_vec[j].bv_page),
|
|
|
- fbio->bi_io_vec[j].bv_len))
|
|
|
+ len))
|
|
|
break;
|
|
|
+ sectors -= len/512;
|
|
|
+ }
|
|
|
if (j == vcnt)
|
|
|
continue;
|
|
|
atomic64_add(r10_bio->sectors, &mddev->resync_mismatches);
|
|
@@ -3407,6 +3413,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
|
|
|
|
|
|
if (bio->bi_end_io == end_sync_read) {
|
|
|
md_sync_acct(bio->bi_bdev, nr_sectors);
|
|
|
+ set_bit(BIO_UPTODATE, &bio->bi_flags);
|
|
|
generic_make_request(bio);
|
|
|
}
|
|
|
}
|