summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorTomasz Majchrzak <tomasz.majchrzak@intel.com>2016-08-23 10:53:57 +0200
committerShaohua Li <shli@fb.com>2016-08-24 10:21:51 -0700
commit27028626b4b9022dcac23688e09ea43b36e1183c (patch)
treec1b2e77abf8a34e3b91ac524a215a5492d0ab188 /drivers/md/raid10.c
parent0f6187dbe542d71ace8ba0908954b0f4f8a30a1e (diff)
downloadop-kernel-dev-27028626b4b9022dcac23688e09ea43b36e1183c.zip
op-kernel-dev-27028626b4b9022dcac23688e09ea43b36e1183c.tar.gz
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 <tomasz.majchrzak@intel.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 1a632a8..4589866 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -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;
OpenPOWER on IntegriCloud