mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
raid10: record correct address of bad block
For failed write request record block address on a device, not block address in an array. Signed-off-by: Tomasz Majchrzak <[email protected]> Signed-off-by: Shaohua Li <[email protected]>
This commit is contained in:
parent
0f6187dbe5
commit
27028626b4
1 changed files with 5 additions and 4 deletions
|
|
@ -2465,20 +2465,21 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
|
|||
|
||||
while (sect_to_write) {
|
||||
struct bio *wbio;
|
||||
sector_t wsector;
|
||||
if (sectors > sect_to_write)
|
||||
sectors = sect_to_write;
|
||||
/* Write at 'sector' for 'sectors' */
|
||||
wbio = bio_clone_mddev(bio, GFP_NOIO, mddev);
|
||||
bio_trim(wbio, sector - bio->bi_iter.bi_sector, sectors);
|
||||
wbio->bi_iter.bi_sector = (r10_bio->devs[i].addr+
|
||||
choose_data_offset(r10_bio, rdev) +
|
||||
(sector - r10_bio->sector));
|
||||
wsector = r10_bio->devs[i].addr + (sector - r10_bio->sector);
|
||||
wbio->bi_iter.bi_sector = wsector +
|
||||
choose_data_offset(r10_bio, rdev);
|
||||
wbio->bi_bdev = rdev->bdev;
|
||||
bio_set_op_attrs(wbio, REQ_OP_WRITE, 0);
|
||||
|
||||
if (submit_bio_wait(wbio) < 0)
|
||||
/* Failure! */
|
||||
ok = rdev_set_badblocks(rdev, sector,
|
||||
ok = rdev_set_badblocks(rdev, wsector,
|
||||
sectors, 0)
|
||||
&& ok;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue