raid1.c (c6380ecd8e9bee7aba3d9a5a94b58168244c4a61) | raid1.c (8b904b5b6b58b9a29dcf3f82d936d9e7fd69fda6) |
---|---|
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. --- 1094 unchanged lines hidden (view full) --- 1103 bio_add_page(behind_bio, page, len, 0); 1104 1105 size -= len; 1106 i++; 1107 } 1108 1109 bio_copy_data(behind_bio, bio); 1110skip_copy: | 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. --- 1094 unchanged lines hidden (view full) --- 1103 bio_add_page(behind_bio, page, len, 0); 1104 1105 size -= len; 1106 i++; 1107 } 1108 1109 bio_copy_data(behind_bio, bio); 1110skip_copy: |
1111 r1_bio->behind_master_bio = behind_bio; | 1111 r1_bio->behind_master_bio = behind_bio;; |
1112 set_bit(R1BIO_BehindIO, &r1_bio->state); 1113 1114 return; 1115 1116free_pages: 1117 pr_debug("%dB behind alloc failed, doing sync I/O\n", 1118 bio->bi_iter.bi_size); 1119 bio_free_pages(behind_bio); --- 635 unchanged lines hidden (view full) --- 1755 rdev->raid_disk = mirror; 1756 err = 0; 1757 conf->fullsync = 1; 1758 rcu_assign_pointer(p[conf->raid_disks].rdev, rdev); 1759 break; 1760 } 1761 } 1762 if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev))) | 1112 set_bit(R1BIO_BehindIO, &r1_bio->state); 1113 1114 return; 1115 1116free_pages: 1117 pr_debug("%dB behind alloc failed, doing sync I/O\n", 1118 bio->bi_iter.bi_size); 1119 bio_free_pages(behind_bio); --- 635 unchanged lines hidden (view full) --- 1755 rdev->raid_disk = mirror; 1756 err = 0; 1757 conf->fullsync = 1; 1758 rcu_assign_pointer(p[conf->raid_disks].rdev, rdev); 1759 break; 1760 } 1761 } 1762 if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev))) |
1763 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 1763 blk_queue_flag_set(QUEUE_FLAG_DISCARD, mddev->queue); |
1764 print_conf(conf); 1765 return err; 1766} 1767 1768static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) 1769{ 1770 struct r1conf *conf = mddev->private; 1771 int err = 0; --- 32 unchanged lines hidden (view full) --- 1804 if (conf->mirrors[conf->raid_disks + number].rdev) { 1805 /* We just removed a device that is being replaced. 1806 * Move down the replacement. We drain all IO before 1807 * doing this to avoid confusion. 1808 */ 1809 struct md_rdev *repl = 1810 conf->mirrors[conf->raid_disks + number].rdev; 1811 freeze_array(conf, 0); | 1764 print_conf(conf); 1765 return err; 1766} 1767 1768static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) 1769{ 1770 struct r1conf *conf = mddev->private; 1771 int err = 0; --- 32 unchanged lines hidden (view full) --- 1804 if (conf->mirrors[conf->raid_disks + number].rdev) { 1805 /* We just removed a device that is being replaced. 1806 * Move down the replacement. We drain all IO before 1807 * doing this to avoid confusion. 1808 */ 1809 struct md_rdev *repl = 1810 conf->mirrors[conf->raid_disks + number].rdev; 1811 freeze_array(conf, 0); |
1812 if (atomic_read(&repl->nr_pending)) { 1813 /* It means that some queued IO of retry_list 1814 * hold repl. Thus, we cannot set replacement 1815 * as NULL, avoiding rdev NULL pointer 1816 * dereference in sync_request_write and 1817 * handle_write_finished. 1818 */ 1819 err = -EBUSY; 1820 unfreeze_array(conf); 1821 goto abort; 1822 } | |
1823 clear_bit(Replacement, &repl->flags); 1824 p->rdev = repl; 1825 conf->mirrors[conf->raid_disks + number].rdev = NULL; 1826 unfreeze_array(conf); 1827 } 1828 1829 clear_bit(WantReplacement, &rdev->flags); 1830 err = md_integrity_register(mddev); --- 1274 unchanged lines hidden (view full) --- 3105 conf->thread = NULL; 3106 mddev->private = conf; 3107 set_bit(MD_FAILFAST_SUPPORTED, &mddev->flags); 3108 3109 md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); 3110 3111 if (mddev->queue) { 3112 if (discard_supported) | 1812 clear_bit(Replacement, &repl->flags); 1813 p->rdev = repl; 1814 conf->mirrors[conf->raid_disks + number].rdev = NULL; 1815 unfreeze_array(conf); 1816 } 1817 1818 clear_bit(WantReplacement, &rdev->flags); 1819 err = md_integrity_register(mddev); --- 1274 unchanged lines hidden (view full) --- 3094 conf->thread = NULL; 3095 mddev->private = conf; 3096 set_bit(MD_FAILFAST_SUPPORTED, &mddev->flags); 3097 3098 md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); 3099 3100 if (mddev->queue) { 3101 if (discard_supported) |
3113 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, | 3102 blk_queue_flag_set(QUEUE_FLAG_DISCARD, |
3114 mddev->queue); 3115 else | 3103 mddev->queue); 3104 else |
3116 queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, | 3105 blk_queue_flag_clear(QUEUE_FLAG_DISCARD, |
3117 mddev->queue); 3118 } 3119 3120 ret = md_integrity_register(mddev); 3121 if (ret) { 3122 md_unregister_thread(&mddev->thread); 3123 raid1_free(mddev, conf); 3124 } --- 227 unchanged lines hidden --- | 3106 mddev->queue); 3107 } 3108 3109 ret = md_integrity_register(mddev); 3110 if (ret) { 3111 md_unregister_thread(&mddev->thread); 3112 raid1_free(mddev, conf); 3113 } --- 227 unchanged lines hidden --- |