diff options
author | Shaohua Li <shli@kernel.org> | 2012-05-21 23:55:05 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:05 -0400 |
commit | bc0934f0477d0a2350a478004799d9c064923b7b (patch) | |
tree | 9ca749760c19637a941e7eed76652e7da298687c /drivers/md | |
parent | cceeca43b5ad96766098144a3fd757e03de9f6f8 (diff) |
raid5: support sync request
REQ_SYNC is ignored in current raid5 code. Block layer does use it to do
policy,
for example ioscheduler. This patch adds it.
Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid5.c | 12 | ||||
-rw-r--r-- | drivers/md/raid5.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 962c8f40908f..7bfd59b313d7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -539,6 +539,8 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
539 | replace_only = 1; | 539 | replace_only = 1; |
540 | } else | 540 | } else |
541 | continue; | 541 | continue; |
542 | if (test_and_clear_bit(R5_SyncIO, &sh->dev[i].flags)) | ||
543 | rw |= REQ_SYNC; | ||
542 | 544 | ||
543 | bi = &sh->dev[i].req; | 545 | bi = &sh->dev[i].req; |
544 | rbi = &sh->dev[i].rreq; /* For writing to replacement */ | 546 | rbi = &sh->dev[i].rreq; /* For writing to replacement */ |
@@ -1145,6 +1147,8 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) | |||
1145 | dev->sector + STRIPE_SECTORS) { | 1147 | dev->sector + STRIPE_SECTORS) { |
1146 | if (wbi->bi_rw & REQ_FUA) | 1148 | if (wbi->bi_rw & REQ_FUA) |
1147 | set_bit(R5_WantFUA, &dev->flags); | 1149 | set_bit(R5_WantFUA, &dev->flags); |
1150 | if (wbi->bi_rw & REQ_SYNC) | ||
1151 | set_bit(R5_SyncIO, &dev->flags); | ||
1148 | tx = async_copy_data(1, wbi, dev->page, | 1152 | tx = async_copy_data(1, wbi, dev->page, |
1149 | dev->sector, tx); | 1153 | dev->sector, tx); |
1150 | wbi = r5_next_bio(wbi, dev->sector); | 1154 | wbi = r5_next_bio(wbi, dev->sector); |
@@ -1162,13 +1166,15 @@ static void ops_complete_reconstruct(void *stripe_head_ref) | |||
1162 | int pd_idx = sh->pd_idx; | 1166 | int pd_idx = sh->pd_idx; |
1163 | int qd_idx = sh->qd_idx; | 1167 | int qd_idx = sh->qd_idx; |
1164 | int i; | 1168 | int i; |
1165 | bool fua = false; | 1169 | bool fua = false, sync = false; |
1166 | 1170 | ||
1167 | pr_debug("%s: stripe %llu\n", __func__, | 1171 | pr_debug("%s: stripe %llu\n", __func__, |
1168 | (unsigned long long)sh->sector); | 1172 | (unsigned long long)sh->sector); |
1169 | 1173 | ||
1170 | for (i = disks; i--; ) | 1174 | for (i = disks; i--; ) { |
1171 | fua |= test_bit(R5_WantFUA, &sh->dev[i].flags); | 1175 | fua |= test_bit(R5_WantFUA, &sh->dev[i].flags); |
1176 | sync |= test_bit(R5_SyncIO, &sh->dev[i].flags); | ||
1177 | } | ||
1172 | 1178 | ||
1173 | for (i = disks; i--; ) { | 1179 | for (i = disks; i--; ) { |
1174 | struct r5dev *dev = &sh->dev[i]; | 1180 | struct r5dev *dev = &sh->dev[i]; |
@@ -1177,6 +1183,8 @@ static void ops_complete_reconstruct(void *stripe_head_ref) | |||
1177 | set_bit(R5_UPTODATE, &dev->flags); | 1183 | set_bit(R5_UPTODATE, &dev->flags); |
1178 | if (fua) | 1184 | if (fua) |
1179 | set_bit(R5_WantFUA, &dev->flags); | 1185 | set_bit(R5_WantFUA, &dev->flags); |
1186 | if (sync) | ||
1187 | set_bit(R5_SyncIO, &dev->flags); | ||
1180 | } | 1188 | } |
1181 | } | 1189 | } |
1182 | 1190 | ||
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index c6bdfa01d987..2164021f3b5f 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -285,6 +285,7 @@ enum r5dev_flags { | |||
285 | */ | 285 | */ |
286 | R5_Wantdrain, /* dev->towrite needs to be drained */ | 286 | R5_Wantdrain, /* dev->towrite needs to be drained */ |
287 | R5_WantFUA, /* Write should be FUA */ | 287 | R5_WantFUA, /* Write should be FUA */ |
288 | R5_SyncIO, /* The IO is sync */ | ||
288 | R5_WriteError, /* got a write error - need to record it */ | 289 | R5_WriteError, /* got a write error - need to record it */ |
289 | R5_MadeGood, /* A bad block has been fixed by writing to it */ | 290 | R5_MadeGood, /* A bad block has been fixed by writing to it */ |
290 | R5_ReadRepl, /* Will/did read from replacement rather than orig */ | 291 | R5_ReadRepl, /* Will/did read from replacement rather than orig */ |