]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/md/raid5.c
drm/bridge: Make the bridge chain a double-linked list
[linux.git] / drivers / md / raid5.c
index 59cafafd5a5dc14c4917e9e8aaba23c0432b5b4f..223e97ab27e6b6f1de5aaeee40a78991e3621b2b 100644 (file)
@@ -2526,7 +2526,8 @@ static void raid5_end_read_request(struct bio * bi)
                int set_bad = 0;
 
                clear_bit(R5_UPTODATE, &sh->dev[i].flags);
-               atomic_inc(&rdev->read_errors);
+               if (!(bi->bi_status == BLK_STS_PROTECTION))
+                       atomic_inc(&rdev->read_errors);
                if (test_bit(R5_ReadRepl, &sh->dev[i].flags))
                        pr_warn_ratelimited(
                                "md/raid:%s: read error on replacement device (sector %llu on %s).\n",
@@ -2549,10 +2550,16 @@ static void raid5_end_read_request(struct bio * bi)
                                (unsigned long long)s,
                                bdn);
                } else if (atomic_read(&rdev->read_errors)
-                        > conf->max_nr_stripes)
-                       pr_warn("md/raid:%s: Too many read errors, failing device %s.\n",
-                              mdname(conf->mddev), bdn);
-               else
+                        > conf->max_nr_stripes) {
+                       if (!test_bit(Faulty, &rdev->flags)) {
+                               pr_warn("md/raid:%s: %d read_errors > %d stripes\n",
+                                   mdname(conf->mddev),
+                                   atomic_read(&rdev->read_errors),
+                                   conf->max_nr_stripes);
+                               pr_warn("md/raid:%s: Too many read errors, failing device %s.\n",
+                                   mdname(conf->mddev), bdn);
+                       }
+               } else
                        retry = 1;
                if (set_bad && test_bit(In_sync, &rdev->flags)
                    && !test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
@@ -4614,7 +4621,6 @@ static void break_stripe_batch_list(struct stripe_head *head_sh,
                                          (1 << STRIPE_FULL_WRITE) |
                                          (1 << STRIPE_BIOFILL_RUN) |
                                          (1 << STRIPE_COMPUTE_RUN)  |
-                                         (1 << STRIPE_OPS_REQ_PENDING) |
                                          (1 << STRIPE_DISCARD) |
                                          (1 << STRIPE_BATCH_READY) |
                                          (1 << STRIPE_BATCH_ERR) |
@@ -5493,7 +5499,7 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi)
                return;
 
        logical_sector = bi->bi_iter.bi_sector & ~((sector_t)STRIPE_SECTORS-1);
-       last_sector = bi->bi_iter.bi_sector + (bi->bi_iter.bi_size>>9);
+       last_sector = bio_end_sector(bi);
 
        bi->bi_next = NULL;
 
@@ -5720,7 +5726,8 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
                                do_flush = false;
                        }
 
-                       set_bit(STRIPE_HANDLE, &sh->state);
+                       if (!sh->batch_head)
+                               set_bit(STRIPE_HANDLE, &sh->state);
                        clear_bit(STRIPE_DELAYED, &sh->state);
                        if ((!sh->batch_head || sh == sh->batch_head) &&
                            (bi->bi_opf & REQ_SYNC) &&