diff options
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index f33a729960ca..6d03bea6fa58 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -238,7 +238,7 @@ static void raid_end_bio_io(r1bio_t *r1_bio) | |||
238 | (unsigned long long) bio->bi_sector + | 238 | (unsigned long long) bio->bi_sector + |
239 | (bio->bi_size >> 9) - 1); | 239 | (bio->bi_size >> 9) - 1); |
240 | 240 | ||
241 | bio_endio(bio, bio->bi_size, | 241 | bio_endio(bio, |
242 | test_bit(R1BIO_Uptodate, &r1_bio->state) ? 0 : -EIO); | 242 | test_bit(R1BIO_Uptodate, &r1_bio->state) ? 0 : -EIO); |
243 | } | 243 | } |
244 | free_r1bio(r1_bio); | 244 | free_r1bio(r1_bio); |
@@ -255,16 +255,13 @@ static inline void update_head_pos(int disk, r1bio_t *r1_bio) | |||
255 | r1_bio->sector + (r1_bio->sectors); | 255 | r1_bio->sector + (r1_bio->sectors); |
256 | } | 256 | } |
257 | 257 | ||
258 | static int raid1_end_read_request(struct bio *bio, unsigned int bytes_done, int error) | 258 | static void raid1_end_read_request(struct bio *bio, int error) |
259 | { | 259 | { |
260 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 260 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
261 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); | 261 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); |
262 | int mirror; | 262 | int mirror; |
263 | conf_t *conf = mddev_to_conf(r1_bio->mddev); | 263 | conf_t *conf = mddev_to_conf(r1_bio->mddev); |
264 | 264 | ||
265 | if (bio->bi_size) | ||
266 | return 1; | ||
267 | |||
268 | mirror = r1_bio->read_disk; | 265 | mirror = r1_bio->read_disk; |
269 | /* | 266 | /* |
270 | * this branch is our 'one mirror IO has finished' event handler: | 267 | * this branch is our 'one mirror IO has finished' event handler: |
@@ -301,10 +298,9 @@ static int raid1_end_read_request(struct bio *bio, unsigned int bytes_done, int | |||
301 | } | 298 | } |
302 | 299 | ||
303 | rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); | 300 | rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev); |
304 | return 0; | ||
305 | } | 301 | } |
306 | 302 | ||
307 | static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int error) | 303 | static void raid1_end_write_request(struct bio *bio, int error) |
308 | { | 304 | { |
309 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 305 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
310 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); | 306 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); |
@@ -312,8 +308,6 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
312 | conf_t *conf = mddev_to_conf(r1_bio->mddev); | 308 | conf_t *conf = mddev_to_conf(r1_bio->mddev); |
313 | struct bio *to_put = NULL; | 309 | struct bio *to_put = NULL; |
314 | 310 | ||
315 | if (bio->bi_size) | ||
316 | return 1; | ||
317 | 311 | ||
318 | for (mirror = 0; mirror < conf->raid_disks; mirror++) | 312 | for (mirror = 0; mirror < conf->raid_disks; mirror++) |
319 | if (r1_bio->bios[mirror] == bio) | 313 | if (r1_bio->bios[mirror] == bio) |
@@ -366,7 +360,7 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
366 | (unsigned long long) mbio->bi_sector, | 360 | (unsigned long long) mbio->bi_sector, |
367 | (unsigned long long) mbio->bi_sector + | 361 | (unsigned long long) mbio->bi_sector + |
368 | (mbio->bi_size >> 9) - 1); | 362 | (mbio->bi_size >> 9) - 1); |
369 | bio_endio(mbio, mbio->bi_size, 0); | 363 | bio_endio(mbio, 0); |
370 | } | 364 | } |
371 | } | 365 | } |
372 | } | 366 | } |
@@ -400,8 +394,6 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
400 | 394 | ||
401 | if (to_put) | 395 | if (to_put) |
402 | bio_put(to_put); | 396 | bio_put(to_put); |
403 | |||
404 | return 0; | ||
405 | } | 397 | } |
406 | 398 | ||
407 | 399 | ||
@@ -796,7 +788,7 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
796 | if (unlikely(!mddev->barriers_work && bio_barrier(bio))) { | 788 | if (unlikely(!mddev->barriers_work && bio_barrier(bio))) { |
797 | if (rw == WRITE) | 789 | if (rw == WRITE) |
798 | md_write_end(mddev); | 790 | md_write_end(mddev); |
799 | bio_endio(bio, bio->bi_size, -EOPNOTSUPP); | 791 | bio_endio(bio, -EOPNOTSUPP); |
800 | return 0; | 792 | return 0; |
801 | } | 793 | } |
802 | 794 | ||
@@ -1137,14 +1129,11 @@ abort: | |||
1137 | } | 1129 | } |
1138 | 1130 | ||
1139 | 1131 | ||
1140 | static int end_sync_read(struct bio *bio, unsigned int bytes_done, int error) | 1132 | static void end_sync_read(struct bio *bio, int error) |
1141 | { | 1133 | { |
1142 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); | 1134 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); |
1143 | int i; | 1135 | int i; |
1144 | 1136 | ||
1145 | if (bio->bi_size) | ||
1146 | return 1; | ||
1147 | |||
1148 | for (i=r1_bio->mddev->raid_disks; i--; ) | 1137 | for (i=r1_bio->mddev->raid_disks; i--; ) |
1149 | if (r1_bio->bios[i] == bio) | 1138 | if (r1_bio->bios[i] == bio) |
1150 | break; | 1139 | break; |
@@ -1160,10 +1149,9 @@ static int end_sync_read(struct bio *bio, unsigned int bytes_done, int error) | |||
1160 | 1149 | ||
1161 | if (atomic_dec_and_test(&r1_bio->remaining)) | 1150 | if (atomic_dec_and_test(&r1_bio->remaining)) |
1162 | reschedule_retry(r1_bio); | 1151 | reschedule_retry(r1_bio); |
1163 | return 0; | ||
1164 | } | 1152 | } |
1165 | 1153 | ||
1166 | static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error) | 1154 | static void end_sync_write(struct bio *bio, int error) |
1167 | { | 1155 | { |
1168 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 1156 | int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
1169 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); | 1157 | r1bio_t * r1_bio = (r1bio_t *)(bio->bi_private); |
@@ -1172,9 +1160,6 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error) | |||
1172 | int i; | 1160 | int i; |
1173 | int mirror=0; | 1161 | int mirror=0; |
1174 | 1162 | ||
1175 | if (bio->bi_size) | ||
1176 | return 1; | ||
1177 | |||
1178 | for (i = 0; i < conf->raid_disks; i++) | 1163 | for (i = 0; i < conf->raid_disks; i++) |
1179 | if (r1_bio->bios[i] == bio) { | 1164 | if (r1_bio->bios[i] == bio) { |
1180 | mirror = i; | 1165 | mirror = i; |
@@ -1200,7 +1185,6 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error) | |||
1200 | md_done_sync(mddev, r1_bio->sectors, uptodate); | 1185 | md_done_sync(mddev, r1_bio->sectors, uptodate); |
1201 | put_buf(r1_bio); | 1186 | put_buf(r1_bio); |
1202 | } | 1187 | } |
1203 | return 0; | ||
1204 | } | 1188 | } |
1205 | 1189 | ||
1206 | static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | 1190 | static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) |