Lines Matching refs:mddev
68 struct mddev md;
239 rs->dev[i].rdev.mddev = &rs->md; in dev_parms()
798 md_error(rdev->mddev, rdev); in read_disk_sb()
807 static void super_sync(struct mddev *mddev, struct md_rdev *rdev) in super_sync() argument
812 struct raid_set *rs = container_of(mddev, struct raid_set, md); in super_sync()
817 for (i = 0; i < mddev->raid_disks; i++) in super_sync()
827 sb->num_devices = cpu_to_le32(mddev->raid_disks); in super_sync()
830 sb->events = cpu_to_le64(mddev->events); in super_sync()
834 sb->array_resync_offset = cpu_to_le64(mddev->recovery_cp); in super_sync()
836 sb->level = cpu_to_le32(mddev->level); in super_sync()
837 sb->layout = cpu_to_le32(mddev->layout); in super_sync()
838 sb->stripe_sectors = cpu_to_le32(mddev->chunk_sectors); in super_sync()
876 super_sync(rdev->mddev, rdev); in super_load()
881 set_bit(MD_CHANGE_DEVS, &rdev->mddev->flags); in super_load()
898 static int super_init_validation(struct mddev *mddev, struct md_rdev *rdev) in super_init_validation() argument
901 struct raid_set *rs = container_of(mddev, struct raid_set, md); in super_init_validation()
917 mddev->events = events_sb ? : 1; in super_init_validation()
922 if (le32_to_cpu(sb->level) != mddev->level) { in super_init_validation()
926 if (le32_to_cpu(sb->layout) != mddev->layout) { in super_init_validation()
928 DMERR(" 0x%X vs 0x%X", le32_to_cpu(sb->layout), mddev->layout); in super_init_validation()
933 raid10_md_layout_to_format(mddev->layout), in super_init_validation()
934 raid10_md_layout_to_copies(mddev->layout)); in super_init_validation()
937 if (le32_to_cpu(sb->stripe_sectors) != mddev->chunk_sectors) { in super_init_validation()
944 (le32_to_cpu(sb->num_devices) != mddev->raid_disks)) { in super_init_validation()
950 mddev->recovery_cp = le64_to_cpu(sb->array_resync_offset); in super_init_validation()
963 rdev_for_each(r, mddev) { in super_init_validation()
973 if (new_devs == mddev->raid_disks) { in super_init_validation()
975 set_bit(MD_ARRAY_FIRST_USE, &mddev->flags); in super_init_validation()
986 } else if (mddev->recovery_cp != MaxSector) { in super_init_validation()
995 rdev_for_each(r, mddev) { in super_init_validation()
1028 static int super_validate(struct mddev *mddev, struct md_rdev *rdev) in super_validate() argument
1036 if (!mddev->events && super_init_validation(mddev, rdev)) in super_validate()
1039 mddev->bitmap_info.offset = 4096 >> 9; /* Enable bitmap creation */ in super_validate()
1040 rdev->mddev->bitmap_info.default_offset = 4096 >> 9; in super_validate()
1070 struct mddev *mddev = &rs->md; in analyse_superblocks() local
1073 rdev_for_each_safe(rdev, tmp, mddev) { in analyse_superblocks()
1142 if (super_validate(mddev, freshest)) in analyse_superblocks()
1145 rdev_for_each(rdev, mddev) in analyse_superblocks()
1146 if ((rdev != freshest) && super_validate(mddev, rdev)) in analyse_superblocks()
1325 struct mddev *mddev = &rs->md; in raid_map() local
1327 mddev->pers->make_request(mddev, bio); in raid_map()
1332 static const char *decipher_sync_action(struct mddev *mddev) in decipher_sync_action() argument
1334 if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) in decipher_sync_action()
1337 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || in decipher_sync_action()
1338 (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { in decipher_sync_action()
1339 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) in decipher_sync_action()
1342 if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { in decipher_sync_action()
1343 if (!test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) in decipher_sync_action()
1345 else if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) in decipher_sync_action()
1350 if (test_bit(MD_RECOVERY_RECOVER, &mddev->recovery)) in decipher_sync_action()
1533 struct mddev *mddev = &rs->md; in raid_message() local
1540 if (!mddev->pers || !mddev->pers->sync_request) in raid_message()
1544 set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); in raid_message()
1546 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); in raid_message()
1549 if (mddev->sync_thread) { in raid_message()
1550 set_bit(MD_RECOVERY_INTR, &mddev->recovery); in raid_message()
1551 md_reap_sync_thread(mddev); in raid_message()
1553 } else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || in raid_message()
1554 test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) in raid_message()
1557 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); in raid_message()
1559 set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); in raid_message()
1560 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); in raid_message()
1563 set_bit(MD_RECOVERY_CHECK, &mddev->recovery); in raid_message()
1566 set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); in raid_message()
1567 set_bit(MD_RECOVERY_SYNC, &mddev->recovery); in raid_message()
1569 if (mddev->ro == 2) { in raid_message()
1573 mddev->ro = 0; in raid_message()
1574 if (!mddev->suspended) in raid_message()
1575 md_wakeup_thread(mddev->sync_thread); in raid_message()
1577 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); in raid_message()
1578 if (!mddev->suspended) in raid_message()
1579 md_wakeup_thread(mddev->thread); in raid_message()
1652 (r->mddev->pers->hot_remove_disk(r->mddev, r) != 0)) in attempt_restore_of_faulty_devices()
1662 if (r->mddev->pers->hot_add_disk(r->mddev, r)) { in attempt_restore_of_faulty_devices()