Loading drivers/md/raid5.c +18 −1 Original line number Diff line number Diff line Loading @@ -1675,6 +1675,8 @@ static void raid5_end_write_request(struct bio *bi, int error) raid5_conf_t *conf = sh->raid_conf; int disks = sh->disks, i; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); sector_t first_bad; int bad_sectors; for (i=0 ; i<disks; i++) if (bi == &sh->dev[i].req) Loading @@ -1691,7 +1693,9 @@ static void raid5_end_write_request(struct bio *bi, int error) if (!uptodate) { set_bit(WriteErrorSeen, &conf->disks[i].rdev->flags); set_bit(R5_WriteError, &sh->dev[i].flags); } } else if (is_badblock(conf->disks[i].rdev, sh->sector, STRIPE_SECTORS, &first_bad, &bad_sectors)) set_bit(R5_MadeGood, &sh->dev[i].flags); rdev_dec_pending(conf->disks[i].rdev, conf->mddev); Loading Loading @@ -3078,6 +3082,13 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) } else clear_bit(R5_WriteError, &dev->flags); } if (test_bit(R5_MadeGood, &dev->flags)) { if (!test_bit(Faulty, &rdev->flags)) { s->handle_bad_blocks = 1; atomic_inc(&rdev->nr_pending); } else clear_bit(R5_MadeGood, &dev->flags); } if (!test_bit(R5_Insync, &dev->flags)) { /* The ReadError flag will just be confusing now */ clear_bit(R5_ReadError, &dev->flags); Loading Loading @@ -3340,6 +3351,12 @@ static void handle_stripe(struct stripe_head *sh) md_error(conf->mddev, rdev); rdev_dec_pending(rdev, conf->mddev); } if (test_and_clear_bit(R5_MadeGood, &dev->flags)) { rdev = conf->disks[i].rdev; rdev_clear_badblocks(rdev, sh->sector, STRIPE_SECTORS); rdev_dec_pending(rdev, conf->mddev); } } if (s.ops_request) Loading drivers/md/raid5.h +1 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,7 @@ struct stripe_head_state { #define R5_Wantdrain 13 /* dev->towrite needs to be drained */ #define R5_WantFUA 14 /* Write should be FUA */ #define R5_WriteError 15 /* got a write error - need to record it */ #define R5_MadeGood 16 /* A bad block has been fixed by writing to it*/ /* * Write method */ Loading Loading
drivers/md/raid5.c +18 −1 Original line number Diff line number Diff line Loading @@ -1675,6 +1675,8 @@ static void raid5_end_write_request(struct bio *bi, int error) raid5_conf_t *conf = sh->raid_conf; int disks = sh->disks, i; int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); sector_t first_bad; int bad_sectors; for (i=0 ; i<disks; i++) if (bi == &sh->dev[i].req) Loading @@ -1691,7 +1693,9 @@ static void raid5_end_write_request(struct bio *bi, int error) if (!uptodate) { set_bit(WriteErrorSeen, &conf->disks[i].rdev->flags); set_bit(R5_WriteError, &sh->dev[i].flags); } } else if (is_badblock(conf->disks[i].rdev, sh->sector, STRIPE_SECTORS, &first_bad, &bad_sectors)) set_bit(R5_MadeGood, &sh->dev[i].flags); rdev_dec_pending(conf->disks[i].rdev, conf->mddev); Loading Loading @@ -3078,6 +3082,13 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) } else clear_bit(R5_WriteError, &dev->flags); } if (test_bit(R5_MadeGood, &dev->flags)) { if (!test_bit(Faulty, &rdev->flags)) { s->handle_bad_blocks = 1; atomic_inc(&rdev->nr_pending); } else clear_bit(R5_MadeGood, &dev->flags); } if (!test_bit(R5_Insync, &dev->flags)) { /* The ReadError flag will just be confusing now */ clear_bit(R5_ReadError, &dev->flags); Loading Loading @@ -3340,6 +3351,12 @@ static void handle_stripe(struct stripe_head *sh) md_error(conf->mddev, rdev); rdev_dec_pending(rdev, conf->mddev); } if (test_and_clear_bit(R5_MadeGood, &dev->flags)) { rdev = conf->disks[i].rdev; rdev_clear_badblocks(rdev, sh->sector, STRIPE_SECTORS); rdev_dec_pending(rdev, conf->mddev); } } if (s.ops_request) Loading
drivers/md/raid5.h +1 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,7 @@ struct stripe_head_state { #define R5_Wantdrain 13 /* dev->towrite needs to be drained */ #define R5_WantFUA 14 /* Write should be FUA */ #define R5_WriteError 15 /* got a write error - need to record it */ #define R5_MadeGood 16 /* A bad block has been fixed by writing to it*/ /* * Write method */ Loading