|
@@ -373,8 +373,6 @@ static unsigned long get_stripe_work(struct stripe_head *sh)
|
|
test_and_ack_op(STRIPE_OP_BIODRAIN, pending);
|
|
test_and_ack_op(STRIPE_OP_BIODRAIN, pending);
|
|
test_and_ack_op(STRIPE_OP_POSTXOR, pending);
|
|
test_and_ack_op(STRIPE_OP_POSTXOR, pending);
|
|
test_and_ack_op(STRIPE_OP_CHECK, pending);
|
|
test_and_ack_op(STRIPE_OP_CHECK, pending);
|
|
- if (test_and_clear_bit(STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- ack++;
|
|
|
|
|
|
|
|
sh->ops.count -= ack;
|
|
sh->ops.count -= ack;
|
|
if (unlikely(sh->ops.count < 0)) {
|
|
if (unlikely(sh->ops.count < 0)) {
|
|
@@ -399,7 +397,6 @@ static void ops_run_io(struct stripe_head *sh)
|
|
|
|
|
|
might_sleep();
|
|
might_sleep();
|
|
|
|
|
|
- set_bit(STRIPE_IO_STARTED, &sh->state);
|
|
|
|
for (i = disks; i--; ) {
|
|
for (i = disks; i--; ) {
|
|
int rw;
|
|
int rw;
|
|
struct bio *bi;
|
|
struct bio *bi;
|
|
@@ -433,6 +430,8 @@ static void ops_run_io(struct stripe_head *sh)
|
|
test_bit(STRIPE_EXPAND_READY, &sh->state))
|
|
test_bit(STRIPE_EXPAND_READY, &sh->state))
|
|
md_sync_acct(rdev->bdev, STRIPE_SECTORS);
|
|
md_sync_acct(rdev->bdev, STRIPE_SECTORS);
|
|
|
|
|
|
|
|
+ set_bit(STRIPE_IO_STARTED, &sh->state);
|
|
|
|
+
|
|
bi->bi_bdev = rdev->bdev;
|
|
bi->bi_bdev = rdev->bdev;
|
|
pr_debug("%s: for %llu schedule op %ld on disc %d\n",
|
|
pr_debug("%s: for %llu schedule op %ld on disc %d\n",
|
|
__func__, (unsigned long long)sh->sector,
|
|
__func__, (unsigned long long)sh->sector,
|
|
@@ -900,9 +899,6 @@ static void raid5_run_ops(struct stripe_head *sh, unsigned long pending)
|
|
if (test_bit(STRIPE_OP_CHECK, &pending))
|
|
if (test_bit(STRIPE_OP_CHECK, &pending))
|
|
ops_run_check(sh);
|
|
ops_run_check(sh);
|
|
|
|
|
|
- if (test_bit(STRIPE_OP_IO, &pending))
|
|
|
|
- ops_run_io(sh);
|
|
|
|
-
|
|
|
|
if (overlap_clear)
|
|
if (overlap_clear)
|
|
for (i = disks; i--; ) {
|
|
for (i = disks; i--; ) {
|
|
struct r5dev *dev = &sh->dev[i];
|
|
struct r5dev *dev = &sh->dev[i];
|
|
@@ -2013,8 +2009,6 @@ static int __handle_issuing_new_read_requests5(struct stripe_head *sh,
|
|
*/
|
|
*/
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
- if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
s->locked++;
|
|
s->locked++;
|
|
pr_debug("Reading block %d (sync=%d)\n", disk_idx,
|
|
pr_debug("Reading block %d (sync=%d)\n", disk_idx,
|
|
s->syncing);
|
|
s->syncing);
|
|
@@ -2208,9 +2202,6 @@ static void handle_issuing_new_write_requests5(raid5_conf_t *conf,
|
|
"%d for r-m-w\n", i);
|
|
"%d for r-m-w\n", i);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
- if (!test_and_set_bit(
|
|
|
|
- STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
s->locked++;
|
|
s->locked++;
|
|
} else {
|
|
} else {
|
|
set_bit(STRIPE_DELAYED, &sh->state);
|
|
set_bit(STRIPE_DELAYED, &sh->state);
|
|
@@ -2234,9 +2225,6 @@ static void handle_issuing_new_write_requests5(raid5_conf_t *conf,
|
|
"%d for Reconstruct\n", i);
|
|
"%d for Reconstruct\n", i);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
- if (!test_and_set_bit(
|
|
|
|
- STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
s->locked++;
|
|
s->locked++;
|
|
} else {
|
|
} else {
|
|
set_bit(STRIPE_DELAYED, &sh->state);
|
|
set_bit(STRIPE_DELAYED, &sh->state);
|
|
@@ -2444,8 +2432,6 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
|
|
|
|
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_Wantwrite, &dev->flags);
|
|
set_bit(R5_Wantwrite, &dev->flags);
|
|
- if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
|
|
|
|
clear_bit(STRIPE_DEGRADED, &sh->state);
|
|
clear_bit(STRIPE_DEGRADED, &sh->state);
|
|
s->locked++;
|
|
s->locked++;
|
|
@@ -2801,9 +2787,6 @@ static void handle_stripe5(struct stripe_head *sh)
|
|
(i == sh->pd_idx || dev->written)) {
|
|
(i == sh->pd_idx || dev->written)) {
|
|
pr_debug("Writing block %d\n", i);
|
|
pr_debug("Writing block %d\n", i);
|
|
set_bit(R5_Wantwrite, &dev->flags);
|
|
set_bit(R5_Wantwrite, &dev->flags);
|
|
- if (!test_and_set_bit(
|
|
|
|
- STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
if (prexor)
|
|
if (prexor)
|
|
continue;
|
|
continue;
|
|
if (!test_bit(R5_Insync, &dev->flags) ||
|
|
if (!test_bit(R5_Insync, &dev->flags) ||
|
|
@@ -2857,16 +2840,12 @@ static void handle_stripe5(struct stripe_head *sh)
|
|
dev = &sh->dev[s.failed_num];
|
|
dev = &sh->dev[s.failed_num];
|
|
if (!test_bit(R5_ReWrite, &dev->flags)) {
|
|
if (!test_bit(R5_ReWrite, &dev->flags)) {
|
|
set_bit(R5_Wantwrite, &dev->flags);
|
|
set_bit(R5_Wantwrite, &dev->flags);
|
|
- if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
set_bit(R5_ReWrite, &dev->flags);
|
|
set_bit(R5_ReWrite, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
s.locked++;
|
|
s.locked++;
|
|
} else {
|
|
} else {
|
|
/* let's read it back */
|
|
/* let's read it back */
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
set_bit(R5_Wantread, &dev->flags);
|
|
- if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
s.locked++;
|
|
s.locked++;
|
|
}
|
|
}
|
|
@@ -2884,13 +2863,10 @@ static void handle_stripe5(struct stripe_head *sh)
|
|
clear_bit(STRIPE_OP_POSTXOR, &sh->ops.ack);
|
|
clear_bit(STRIPE_OP_POSTXOR, &sh->ops.ack);
|
|
clear_bit(STRIPE_OP_POSTXOR, &sh->ops.complete);
|
|
clear_bit(STRIPE_OP_POSTXOR, &sh->ops.complete);
|
|
|
|
|
|
- for (i = conf->raid_disks; i--; ) {
|
|
|
|
|
|
+ for (i = conf->raid_disks; i--; )
|
|
set_bit(R5_Wantwrite, &sh->dev[i].flags);
|
|
set_bit(R5_Wantwrite, &sh->dev[i].flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
set_bit(R5_LOCKED, &dev->flags);
|
|
s.locked++;
|
|
s.locked++;
|
|
- if (!test_and_set_bit(STRIPE_OP_IO, &sh->ops.pending))
|
|
|
|
- sh->ops.count++;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (s.expanded && test_bit(STRIPE_EXPANDING, &sh->state) &&
|
|
if (s.expanded && test_bit(STRIPE_EXPANDING, &sh->state) &&
|
|
@@ -2926,6 +2902,8 @@ static void handle_stripe5(struct stripe_head *sh)
|
|
if (pending)
|
|
if (pending)
|
|
raid5_run_ops(sh, pending);
|
|
raid5_run_ops(sh, pending);
|
|
|
|
|
|
|
|
+ ops_run_io(sh);
|
|
|
|
+
|
|
return_io(return_bi);
|
|
return_io(return_bi);
|
|
|
|
|
|
}
|
|
}
|