raid1.c (8c57a5e7b2820f349c95b8c8393fec1e0f4070d2) | raid1.c (70246286e94c335b5bea0cbc68a17a96dd620281) |
---|---|
1/* 2 * raid1.c : Multiple Devices driver for Linux 3 * 4 * Copyright (C) 1999, 2000, 2001 Ingo Molnar, Red Hat 5 * 6 * Copyright (C) 1996, 1997, 1998 Ingo Molnar, Miguel de Icaza, Gadi Oxman 7 * 8 * RAID-1 management functions. --- 745 unchanged lines hidden (view full) --- 754 /* flush any pending bitmap writes to 755 * disk before proceeding w/ I/O */ 756 bitmap_unplug(conf->mddev->bitmap); 757 wake_up(&conf->wait_barrier); 758 759 while (bio) { /* submit pending writes */ 760 struct bio *next = bio->bi_next; 761 bio->bi_next = NULL; | 1/* 2 * raid1.c : Multiple Devices driver for Linux 3 * 4 * Copyright (C) 1999, 2000, 2001 Ingo Molnar, Red Hat 5 * 6 * Copyright (C) 1996, 1997, 1998 Ingo Molnar, Miguel de Icaza, Gadi Oxman 7 * 8 * RAID-1 management functions. --- 745 unchanged lines hidden (view full) --- 754 /* flush any pending bitmap writes to 755 * disk before proceeding w/ I/O */ 756 bitmap_unplug(conf->mddev->bitmap); 757 wake_up(&conf->wait_barrier); 758 759 while (bio) { /* submit pending writes */ 760 struct bio *next = bio->bi_next; 761 bio->bi_next = NULL; |
762 if (unlikely((bio->bi_rw & REQ_DISCARD) && | 762 if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && |
763 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 764 /* Just ignore it */ 765 bio_endio(bio); 766 else 767 generic_make_request(bio); 768 bio = next; 769 } 770 } else --- 257 unchanged lines hidden (view full) --- 1028 /* we aren't scheduling, so we can do the write-out directly. */ 1029 bio = bio_list_get(&plug->pending); 1030 bitmap_unplug(mddev->bitmap); 1031 wake_up(&conf->wait_barrier); 1032 1033 while (bio) { /* submit pending writes */ 1034 struct bio *next = bio->bi_next; 1035 bio->bi_next = NULL; | 763 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 764 /* Just ignore it */ 765 bio_endio(bio); 766 else 767 generic_make_request(bio); 768 bio = next; 769 } 770 } else --- 257 unchanged lines hidden (view full) --- 1028 /* we aren't scheduling, so we can do the write-out directly. */ 1029 bio = bio_list_get(&plug->pending); 1030 bitmap_unplug(mddev->bitmap); 1031 wake_up(&conf->wait_barrier); 1032 1033 while (bio) { /* submit pending writes */ 1034 struct bio *next = bio->bi_next; 1035 bio->bi_next = NULL; |
1036 if (unlikely((bio->bi_rw & REQ_DISCARD) && | 1036 if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && |
1037 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 1038 /* Just ignore it */ 1039 bio_endio(bio); 1040 else 1041 generic_make_request(bio); 1042 bio = next; 1043 } 1044 kfree(plug); 1045} 1046 1047static void raid1_make_request(struct mddev *mddev, struct bio * bio) 1048{ 1049 struct r1conf *conf = mddev->private; 1050 struct raid1_info *mirror; 1051 struct r1bio *r1_bio; 1052 struct bio *read_bio; 1053 int i, disks; 1054 struct bitmap *bitmap; 1055 unsigned long flags; | 1037 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 1038 /* Just ignore it */ 1039 bio_endio(bio); 1040 else 1041 generic_make_request(bio); 1042 bio = next; 1043 } 1044 kfree(plug); 1045} 1046 1047static void raid1_make_request(struct mddev *mddev, struct bio * bio) 1048{ 1049 struct r1conf *conf = mddev->private; 1050 struct raid1_info *mirror; 1051 struct r1bio *r1_bio; 1052 struct bio *read_bio; 1053 int i, disks; 1054 struct bitmap *bitmap; 1055 unsigned long flags; |
1056 const int op = bio_op(bio); |
|
1056 const int rw = bio_data_dir(bio); 1057 const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); | 1057 const int rw = bio_data_dir(bio); 1058 const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); |
1058 const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); 1059 const unsigned long do_discard = (bio->bi_rw 1060 & (REQ_DISCARD | REQ_SECURE)); 1061 const unsigned long do_same = (bio->bi_rw & REQ_WRITE_SAME); | 1059 const unsigned long do_flush_fua = (bio->bi_rw & 1060 (REQ_PREFLUSH | REQ_FUA)); |
1062 struct md_rdev *blocked_rdev; 1063 struct blk_plug_cb *cb; 1064 struct raid1_plug_cb *plug = NULL; 1065 int first_clone; 1066 int sectors_handled; 1067 int max_sectors; 1068 sector_t start_next_window; 1069 --- 31 unchanged lines hidden (view full) --- 1101 finish_wait(&conf->wait_barrier, &w); 1102 } 1103 1104 start_next_window = wait_barrier(conf, bio); 1105 1106 bitmap = mddev->bitmap; 1107 1108 /* | 1061 struct md_rdev *blocked_rdev; 1062 struct blk_plug_cb *cb; 1063 struct raid1_plug_cb *plug = NULL; 1064 int first_clone; 1065 int sectors_handled; 1066 int max_sectors; 1067 sector_t start_next_window; 1068 --- 31 unchanged lines hidden (view full) --- 1100 finish_wait(&conf->wait_barrier, &w); 1101 } 1102 1103 start_next_window = wait_barrier(conf, bio); 1104 1105 bitmap = mddev->bitmap; 1106 1107 /* |
1109 * make_request() can abort the operation when READA is being | 1108 * make_request() can abort the operation when read-ahead is being |
1110 * used and no empty request is available. 1111 * 1112 */ 1113 r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); 1114 1115 r1_bio->master_bio = bio; 1116 r1_bio->sectors = bio_sectors(bio); 1117 r1_bio->state = 0; --- 43 unchanged lines hidden (view full) --- 1161 max_sectors); 1162 1163 r1_bio->bios[rdisk] = read_bio; 1164 1165 read_bio->bi_iter.bi_sector = r1_bio->sector + 1166 mirror->rdev->data_offset; 1167 read_bio->bi_bdev = mirror->rdev->bdev; 1168 read_bio->bi_end_io = raid1_end_read_request; | 1109 * used and no empty request is available. 1110 * 1111 */ 1112 r1_bio = mempool_alloc(conf->r1bio_pool, GFP_NOIO); 1113 1114 r1_bio->master_bio = bio; 1115 r1_bio->sectors = bio_sectors(bio); 1116 r1_bio->state = 0; --- 43 unchanged lines hidden (view full) --- 1160 max_sectors); 1161 1162 r1_bio->bios[rdisk] = read_bio; 1163 1164 read_bio->bi_iter.bi_sector = r1_bio->sector + 1165 mirror->rdev->data_offset; 1166 read_bio->bi_bdev = mirror->rdev->bdev; 1167 read_bio->bi_end_io = raid1_end_read_request; |
1169 read_bio->bi_rw = READ | do_sync; | 1168 bio_set_op_attrs(read_bio, op, do_sync); |
1170 read_bio->bi_private = r1_bio; 1171 1172 if (max_sectors < r1_bio->sectors) { 1173 /* could not read all from this device, so we will 1174 * need another r1_bio. 1175 */ 1176 1177 sectors_handled = (r1_bio->sector + max_sectors --- 193 unchanged lines hidden (view full) --- 1371 } 1372 1373 r1_bio->bios[i] = mbio; 1374 1375 mbio->bi_iter.bi_sector = (r1_bio->sector + 1376 conf->mirrors[i].rdev->data_offset); 1377 mbio->bi_bdev = conf->mirrors[i].rdev->bdev; 1378 mbio->bi_end_io = raid1_end_write_request; | 1169 read_bio->bi_private = r1_bio; 1170 1171 if (max_sectors < r1_bio->sectors) { 1172 /* could not read all from this device, so we will 1173 * need another r1_bio. 1174 */ 1175 1176 sectors_handled = (r1_bio->sector + max_sectors --- 193 unchanged lines hidden (view full) --- 1370 } 1371 1372 r1_bio->bios[i] = mbio; 1373 1374 mbio->bi_iter.bi_sector = (r1_bio->sector + 1375 conf->mirrors[i].rdev->data_offset); 1376 mbio->bi_bdev = conf->mirrors[i].rdev->bdev; 1377 mbio->bi_end_io = raid1_end_write_request; |
1379 mbio->bi_rw = 1380 WRITE | do_flush_fua | do_sync | do_discard | do_same; | 1378 bio_set_op_attrs(mbio, op, do_flush_fua | do_sync); |
1381 mbio->bi_private = r1_bio; 1382 1383 atomic_inc(&r1_bio->remaining); 1384 1385 cb = blk_check_plugged(raid1_unplug, mddev, sizeof(*plug)); 1386 if (cb) 1387 plug = container_of(cb, struct raid1_plug_cb, cb); 1388 else --- 80 unchanged lines hidden (view full) --- 1469 set_bit(Faulty, &rdev->flags); 1470 } else 1471 set_bit(Faulty, &rdev->flags); 1472 spin_unlock_irqrestore(&conf->device_lock, flags); 1473 /* 1474 * if recovery is running, make sure it aborts. 1475 */ 1476 set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 1379 mbio->bi_private = r1_bio; 1380 1381 atomic_inc(&r1_bio->remaining); 1382 1383 cb = blk_check_plugged(raid1_unplug, mddev, sizeof(*plug)); 1384 if (cb) 1385 plug = container_of(cb, struct raid1_plug_cb, cb); 1386 else --- 80 unchanged lines hidden (view full) --- 1467 set_bit(Faulty, &rdev->flags); 1468 } else 1469 set_bit(Faulty, &rdev->flags); 1470 spin_unlock_irqrestore(&conf->device_lock, flags); 1471 /* 1472 * if recovery is running, make sure it aborts. 1473 */ 1474 set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1477 set_bit(MD_CHANGE_DEVS, &mddev->flags); 1478 set_bit(MD_CHANGE_PENDING, &mddev->flags); | 1475 set_mask_bits(&mddev->flags, 0, 1476 BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); |
1479 printk(KERN_ALERT 1480 "md/raid1:%s: Disk failure on %s, disabling device.\n" 1481 "md/raid1:%s: Operation continuing on %d devices.\n", 1482 mdname(mddev), bdevname(rdev->bdev, b), 1483 mdname(mddev), conf->raid_disks - mddev->degraded); 1484} 1485 1486static void print_conf(struct r1conf *conf) --- 279 unchanged lines hidden (view full) --- 1766 md_done_sync(mddev, s, uptodate); 1767 } 1768 } 1769} 1770 1771static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector, 1772 int sectors, struct page *page, int rw) 1773{ | 1477 printk(KERN_ALERT 1478 "md/raid1:%s: Disk failure on %s, disabling device.\n" 1479 "md/raid1:%s: Operation continuing on %d devices.\n", 1480 mdname(mddev), bdevname(rdev->bdev, b), 1481 mdname(mddev), conf->raid_disks - mddev->degraded); 1482} 1483 1484static void print_conf(struct r1conf *conf) --- 279 unchanged lines hidden (view full) --- 1764 md_done_sync(mddev, s, uptodate); 1765 } 1766 } 1767} 1768 1769static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector, 1770 int sectors, struct page *page, int rw) 1771{ |
1774 if (sync_page_io(rdev, sector, sectors << 9, page, rw, false)) | 1772 if (sync_page_io(rdev, sector, sectors << 9, page, rw, 0, false)) |
1775 /* success */ 1776 return 1; 1777 if (rw == WRITE) { 1778 set_bit(WriteErrorSeen, &rdev->flags); 1779 if (!test_and_set_bit(WantReplacement, 1780 &rdev->flags)) 1781 set_bit(MD_RECOVERY_NEEDED, & 1782 rdev->mddev->recovery); --- 37 unchanged lines hidden (view full) --- 1820 if (r1_bio->bios[d]->bi_end_io == end_sync_read) { 1821 /* No rcu protection needed here devices 1822 * can only be removed when no resync is 1823 * active, and resync is currently active 1824 */ 1825 rdev = conf->mirrors[d].rdev; 1826 if (sync_page_io(rdev, sect, s<<9, 1827 bio->bi_io_vec[idx].bv_page, | 1773 /* success */ 1774 return 1; 1775 if (rw == WRITE) { 1776 set_bit(WriteErrorSeen, &rdev->flags); 1777 if (!test_and_set_bit(WantReplacement, 1778 &rdev->flags)) 1779 set_bit(MD_RECOVERY_NEEDED, & 1780 rdev->mddev->recovery); --- 37 unchanged lines hidden (view full) --- 1818 if (r1_bio->bios[d]->bi_end_io == end_sync_read) { 1819 /* No rcu protection needed here devices 1820 * can only be removed when no resync is 1821 * active, and resync is currently active 1822 */ 1823 rdev = conf->mirrors[d].rdev; 1824 if (sync_page_io(rdev, sect, s<<9, 1825 bio->bi_io_vec[idx].bv_page, |
1828 READ, false)) { | 1826 REQ_OP_READ, 0, false)) { |
1829 success = 1; 1830 break; 1831 } 1832 } 1833 d++; 1834 if (d == conf->raid_disks * 2) 1835 d = 0; 1836 } while (!success && d != r1_bio->read_disk); --- 188 unchanged lines hidden (view full) --- 2025 for (i = 0; i < disks ; i++) { 2026 wbio = r1_bio->bios[i]; 2027 if (wbio->bi_end_io == NULL || 2028 (wbio->bi_end_io == end_sync_read && 2029 (i == r1_bio->read_disk || 2030 !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) 2031 continue; 2032 | 1827 success = 1; 1828 break; 1829 } 1830 } 1831 d++; 1832 if (d == conf->raid_disks * 2) 1833 d = 0; 1834 } while (!success && d != r1_bio->read_disk); --- 188 unchanged lines hidden (view full) --- 2023 for (i = 0; i < disks ; i++) { 2024 wbio = r1_bio->bios[i]; 2025 if (wbio->bi_end_io == NULL || 2026 (wbio->bi_end_io == end_sync_read && 2027 (i == r1_bio->read_disk || 2028 !test_bit(MD_RECOVERY_SYNC, &mddev->recovery)))) 2029 continue; 2030 |
2033 wbio->bi_rw = WRITE; | 2031 bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
2034 wbio->bi_end_io = end_sync_write; 2035 atomic_inc(&r1_bio->remaining); 2036 md_sync_acct(conf->mirrors[i].rdev->bdev, bio_sectors(wbio)); 2037 2038 generic_make_request(wbio); 2039 } 2040 2041 if (atomic_dec_and_test(&r1_bio->remaining)) { --- 43 unchanged lines hidden (view full) --- 2085 rdev = conf->mirrors[d].rdev; 2086 if (rdev && 2087 (test_bit(In_sync, &rdev->flags) || 2088 (!test_bit(Faulty, &rdev->flags) && 2089 rdev->recovery_offset >= sect + s)) && 2090 is_badblock(rdev, sect, s, 2091 &first_bad, &bad_sectors) == 0 && 2092 sync_page_io(rdev, sect, s<<9, | 2032 wbio->bi_end_io = end_sync_write; 2033 atomic_inc(&r1_bio->remaining); 2034 md_sync_acct(conf->mirrors[i].rdev->bdev, bio_sectors(wbio)); 2035 2036 generic_make_request(wbio); 2037 } 2038 2039 if (atomic_dec_and_test(&r1_bio->remaining)) { --- 43 unchanged lines hidden (view full) --- 2083 rdev = conf->mirrors[d].rdev; 2084 if (rdev && 2085 (test_bit(In_sync, &rdev->flags) || 2086 (!test_bit(Faulty, &rdev->flags) && 2087 rdev->recovery_offset >= sect + s)) && 2088 is_badblock(rdev, sect, s, 2089 &first_bad, &bad_sectors) == 0 && 2090 sync_page_io(rdev, sect, s<<9, |
2093 conf->tmppage, READ, false)) | 2091 conf->tmppage, REQ_OP_READ, 0, false)) |
2094 success = 1; 2095 else { 2096 d++; 2097 if (d == conf->raid_disks * 2) 2098 d = 0; 2099 } 2100 } while (!success && d != read_disk); 2101 --- 94 unchanged lines hidden (view full) --- 2196 wbio = bio_alloc_mddev(GFP_NOIO, vcnt, mddev); 2197 memcpy(wbio->bi_io_vec, vec, vcnt * sizeof(struct bio_vec)); 2198 2199 wbio->bi_vcnt = vcnt; 2200 } else { 2201 wbio = bio_clone_mddev(r1_bio->master_bio, GFP_NOIO, mddev); 2202 } 2203 | 2092 success = 1; 2093 else { 2094 d++; 2095 if (d == conf->raid_disks * 2) 2096 d = 0; 2097 } 2098 } while (!success && d != read_disk); 2099 --- 94 unchanged lines hidden (view full) --- 2194 wbio = bio_alloc_mddev(GFP_NOIO, vcnt, mddev); 2195 memcpy(wbio->bi_io_vec, vec, vcnt * sizeof(struct bio_vec)); 2196 2197 wbio->bi_vcnt = vcnt; 2198 } else { 2199 wbio = bio_clone_mddev(r1_bio->master_bio, GFP_NOIO, mddev); 2200 } 2201 |
2204 wbio->bi_rw = WRITE; | 2202 bio_set_op_attrs(wbio, REQ_OP_WRITE, 0); |
2205 wbio->bi_iter.bi_sector = r1_bio->sector; 2206 wbio->bi_iter.bi_size = r1_bio->sectors << 9; 2207 2208 bio_trim(wbio, sector - r1_bio->sector, sectors); 2209 wbio->bi_iter.bi_sector += rdev->data_offset; 2210 wbio->bi_bdev = rdev->bdev; | 2203 wbio->bi_iter.bi_sector = r1_bio->sector; 2204 wbio->bi_iter.bi_size = r1_bio->sectors << 9; 2205 2206 bio_trim(wbio, sector - r1_bio->sector, sectors); 2207 wbio->bi_iter.bi_sector += rdev->data_offset; 2208 wbio->bi_bdev = rdev->bdev; |
2211 if (submit_bio_wait(WRITE, wbio) < 0) | 2209 2210 if (submit_bio_wait(wbio) < 0) |
2212 /* failure! */ 2213 ok = rdev_set_badblocks(rdev, sector, 2214 sectors, 0) 2215 && ok; 2216 2217 bio_put(wbio); 2218 sect_to_write -= sectors; 2219 sector += sectors; --- 118 unchanged lines hidden (view full) --- 2338 "md/raid1:%s: redirecting sector %llu" 2339 " to other mirror: %s\n", 2340 mdname(mddev), 2341 (unsigned long long)r1_bio->sector, 2342 bdevname(rdev->bdev, b)); 2343 bio->bi_iter.bi_sector = r1_bio->sector + rdev->data_offset; 2344 bio->bi_bdev = rdev->bdev; 2345 bio->bi_end_io = raid1_end_read_request; | 2211 /* failure! */ 2212 ok = rdev_set_badblocks(rdev, sector, 2213 sectors, 0) 2214 && ok; 2215 2216 bio_put(wbio); 2217 sect_to_write -= sectors; 2218 sector += sectors; --- 118 unchanged lines hidden (view full) --- 2337 "md/raid1:%s: redirecting sector %llu" 2338 " to other mirror: %s\n", 2339 mdname(mddev), 2340 (unsigned long long)r1_bio->sector, 2341 bdevname(rdev->bdev, b)); 2342 bio->bi_iter.bi_sector = r1_bio->sector + rdev->data_offset; 2343 bio->bi_bdev = rdev->bdev; 2344 bio->bi_end_io = raid1_end_read_request; |
2346 bio->bi_rw = READ | do_sync; | 2345 bio_set_op_attrs(bio, REQ_OP_READ, do_sync); |
2347 bio->bi_private = r1_bio; 2348 if (max_sectors < r1_bio->sectors) { 2349 /* Drat - have to split this up more */ 2350 struct bio *mbio = r1_bio->master_bio; 2351 int sectors_handled = (r1_bio->sector + max_sectors 2352 - mbio->bi_iter.bi_sector); 2353 r1_bio->sectors = max_sectors; 2354 spin_lock_irq(&conf->device_lock); --- 211 unchanged lines hidden (view full) --- 2566 bio_reset(bio); 2567 2568 rdev = rcu_dereference(conf->mirrors[i].rdev); 2569 if (rdev == NULL || 2570 test_bit(Faulty, &rdev->flags)) { 2571 if (i < conf->raid_disks) 2572 still_degraded = 1; 2573 } else if (!test_bit(In_sync, &rdev->flags)) { | 2346 bio->bi_private = r1_bio; 2347 if (max_sectors < r1_bio->sectors) { 2348 /* Drat - have to split this up more */ 2349 struct bio *mbio = r1_bio->master_bio; 2350 int sectors_handled = (r1_bio->sector + max_sectors 2351 - mbio->bi_iter.bi_sector); 2352 r1_bio->sectors = max_sectors; 2353 spin_lock_irq(&conf->device_lock); --- 211 unchanged lines hidden (view full) --- 2565 bio_reset(bio); 2566 2567 rdev = rcu_dereference(conf->mirrors[i].rdev); 2568 if (rdev == NULL || 2569 test_bit(Faulty, &rdev->flags)) { 2570 if (i < conf->raid_disks) 2571 still_degraded = 1; 2572 } else if (!test_bit(In_sync, &rdev->flags)) { |
2574 bio->bi_rw = WRITE; | 2573 bio_set_op_attrs(bio, REQ_OP_WRITE, 0); |
2575 bio->bi_end_io = end_sync_write; 2576 write_targets ++; 2577 } else { 2578 /* may need to read from here */ 2579 sector_t first_bad = MaxSector; 2580 int bad_sectors; 2581 2582 if (is_badblock(rdev, sector_nr, good_sectors, --- 10 unchanged lines hidden (view full) --- 2593 if (sector_nr < first_bad) { 2594 if (test_bit(WriteMostly, &rdev->flags)) { 2595 if (wonly < 0) 2596 wonly = i; 2597 } else { 2598 if (disk < 0) 2599 disk = i; 2600 } | 2574 bio->bi_end_io = end_sync_write; 2575 write_targets ++; 2576 } else { 2577 /* may need to read from here */ 2578 sector_t first_bad = MaxSector; 2579 int bad_sectors; 2580 2581 if (is_badblock(rdev, sector_nr, good_sectors, --- 10 unchanged lines hidden (view full) --- 2592 if (sector_nr < first_bad) { 2593 if (test_bit(WriteMostly, &rdev->flags)) { 2594 if (wonly < 0) 2595 wonly = i; 2596 } else { 2597 if (disk < 0) 2598 disk = i; 2599 } |
2601 bio->bi_rw = READ; | 2600 bio_set_op_attrs(bio, REQ_OP_READ, 0); |
2602 bio->bi_end_io = end_sync_read; 2603 read_targets++; 2604 } else if (!test_bit(WriteErrorSeen, &rdev->flags) && 2605 test_bit(MD_RECOVERY_SYNC, &mddev->recovery) && 2606 !test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { 2607 /* 2608 * The device is suitable for reading (InSync), 2609 * but has bad block(s) here. Let's try to correct them, 2610 * if we are doing resync or repair. Otherwise, leave 2611 * this device alone for this sync request. 2612 */ | 2601 bio->bi_end_io = end_sync_read; 2602 read_targets++; 2603 } else if (!test_bit(WriteErrorSeen, &rdev->flags) && 2604 test_bit(MD_RECOVERY_SYNC, &mddev->recovery) && 2605 !test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { 2606 /* 2607 * The device is suitable for reading (InSync), 2608 * but has bad block(s) here. Let's try to correct them, 2609 * if we are doing resync or repair. Otherwise, leave 2610 * this device alone for this sync request. 2611 */ |
2613 bio->bi_rw = WRITE; | 2612 bio_set_op_attrs(bio, REQ_OP_WRITE, 0); |
2614 bio->bi_end_io = end_sync_write; 2615 write_targets++; 2616 } 2617 } 2618 if (bio->bi_end_io) { 2619 atomic_inc(&rdev->nr_pending); 2620 bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; 2621 bio->bi_bdev = rdev->bdev; --- 590 unchanged lines hidden --- | 2613 bio->bi_end_io = end_sync_write; 2614 write_targets++; 2615 } 2616 } 2617 if (bio->bi_end_io) { 2618 atomic_inc(&rdev->nr_pending); 2619 bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; 2620 bio->bi_bdev = rdev->bdev; --- 590 unchanged lines hidden --- |