Lines Matching refs:sb
2083 static void sb_retrieve_failed_devices(struct dm_raid_superblock *sb, uint64_t *failed_devices) in sb_retrieve_failed_devices() argument
2085 failed_devices[0] = le64_to_cpu(sb->failed_devices); in sb_retrieve_failed_devices()
2086 memset(failed_devices + 1, 0, sizeof(sb->extended_failed_devices)); in sb_retrieve_failed_devices()
2088 if (le32_to_cpu(sb->compat_features) & FEATURE_FLAG_SUPPORTS_V190) { in sb_retrieve_failed_devices()
2089 int i = ARRAY_SIZE(sb->extended_failed_devices); in sb_retrieve_failed_devices()
2092 failed_devices[i+1] = le64_to_cpu(sb->extended_failed_devices[i]); in sb_retrieve_failed_devices()
2096 static void sb_update_failed_devices(struct dm_raid_superblock *sb, uint64_t *failed_devices) in sb_update_failed_devices() argument
2098 int i = ARRAY_SIZE(sb->extended_failed_devices); in sb_update_failed_devices()
2100 sb->failed_devices = cpu_to_le64(failed_devices[0]); in sb_update_failed_devices()
2102 sb->extended_failed_devices[i] = cpu_to_le64(failed_devices[i+1]); in sb_update_failed_devices()
2115 struct dm_raid_superblock *sb; in super_sync() local
2124 sb = page_address(rdev->sb_page); in super_sync()
2126 sb_retrieve_failed_devices(sb, failed_devices); in super_sync()
2135 sb_update_failed_devices(sb, failed_devices); in super_sync()
2137 sb->magic = cpu_to_le32(DM_RAID_MAGIC); in super_sync()
2138 sb->compat_features = cpu_to_le32(FEATURE_FLAG_SUPPORTS_V190); in super_sync()
2140 sb->num_devices = cpu_to_le32(mddev->raid_disks); in super_sync()
2141 sb->array_position = cpu_to_le32(rdev->raid_disk); in super_sync()
2143 sb->events = cpu_to_le64(mddev->events); in super_sync()
2145 sb->disk_recovery_offset = cpu_to_le64(rdev->recovery_offset); in super_sync()
2146 sb->array_resync_offset = cpu_to_le64(mddev->resync_offset); in super_sync()
2148 sb->level = cpu_to_le32(mddev->level); in super_sync()
2149 sb->layout = cpu_to_le32(mddev->layout); in super_sync()
2150 sb->stripe_sectors = cpu_to_le32(mddev->chunk_sectors); in super_sync()
2157 sb->new_level = cpu_to_le32(mddev->new_level); in super_sync()
2158 sb->new_layout = cpu_to_le32(mddev->new_layout); in super_sync()
2159 sb->new_stripe_sectors = cpu_to_le32(mddev->new_chunk_sectors); in super_sync()
2161 sb->delta_disks = cpu_to_le32(mddev->delta_disks); in super_sync()
2164 sb->reshape_position = cpu_to_le64(mddev->reshape_position); in super_sync()
2165 if (le64_to_cpu(sb->reshape_position) != MaxSector) { in super_sync()
2167 sb->flags |= cpu_to_le32(SB_FLAG_RESHAPE_ACTIVE); in super_sync()
2170 sb->flags |= cpu_to_le32(SB_FLAG_RESHAPE_BACKWARDS); in super_sync()
2173 sb->flags &= ~(cpu_to_le32(SB_FLAG_RESHAPE_ACTIVE|SB_FLAG_RESHAPE_BACKWARDS)); in super_sync()
2176 sb->array_sectors = cpu_to_le64(mddev->array_sectors); in super_sync()
2177 sb->data_offset = cpu_to_le64(rdev->data_offset); in super_sync()
2178 sb->new_data_offset = cpu_to_le64(rdev->new_data_offset); in super_sync()
2179 sb->sectors = cpu_to_le64(rdev->sectors); in super_sync()
2180 sb->incompat_features = cpu_to_le32(0); in super_sync()
2183 memset(sb + 1, 0, rdev->sb_size - sizeof(*sb)); in super_sync()
2197 struct dm_raid_superblock *sb; in super_load() local
2205 sb = page_address(rdev->sb_page); in super_load()
2212 if ((sb->magic != cpu_to_le32(DM_RAID_MAGIC)) || in super_load()
2217 sb->compat_features = cpu_to_le32(FEATURE_FLAG_SUPPORTS_V190); in super_load()
2229 events_sb = le64_to_cpu(sb->events); in super_load()
2243 struct dm_raid_superblock *sb; in super_init_validation() local
2248 sb = page_address(rdev->sb_page); in super_init_validation()
2249 events_sb = le64_to_cpu(sb->events); in super_init_validation()
2258 mddev->raid_disks = le32_to_cpu(sb->num_devices); in super_init_validation()
2259 mddev->level = le32_to_cpu(sb->level); in super_init_validation()
2260 mddev->layout = le32_to_cpu(sb->layout); in super_init_validation()
2261 mddev->chunk_sectors = le32_to_cpu(sb->stripe_sectors); in super_init_validation()
2267 if (le32_to_cpu(sb->compat_features) & FEATURE_FLAG_SUPPORTS_V190) { in super_init_validation()
2269 mddev->new_level = le32_to_cpu(sb->new_level); in super_init_validation()
2270 mddev->new_layout = le32_to_cpu(sb->new_layout); in super_init_validation()
2271 mddev->new_chunk_sectors = le32_to_cpu(sb->new_stripe_sectors); in super_init_validation()
2272 mddev->delta_disks = le32_to_cpu(sb->delta_disks); in super_init_validation()
2273 mddev->array_sectors = le64_to_cpu(sb->array_sectors); in super_init_validation()
2276 if (le32_to_cpu(sb->flags) & SB_FLAG_RESHAPE_ACTIVE) { in super_init_validation()
2283 (!mddev->delta_disks && (le32_to_cpu(sb->flags) & SB_FLAG_RESHAPE_BACKWARDS))) in super_init_validation()
2288 mddev->reshape_position = le64_to_cpu(sb->reshape_position); in super_init_validation()
2314 le32_to_cpu(sb->layout), mddev->new_layout); in super_init_validation()
2337 mddev->resync_offset = le64_to_cpu(sb->array_resync_offset); in super_init_validation()
2407 sb_retrieve_failed_devices(sb, failed_devices); in super_init_validation()
2460 struct dm_raid_superblock *sb; in super_validate() local
2465 sb = page_address(rdev->sb_page); in super_validate()
2474 if (le32_to_cpu(sb->compat_features) && in super_validate()
2475 le32_to_cpu(sb->compat_features) != FEATURE_FLAG_SUPPORTS_V190) { in super_validate()
2480 if (sb->incompat_features) { in super_validate()
2495 if (le32_to_cpu(sb->compat_features) & FEATURE_FLAG_SUPPORTS_V190) in super_validate()
2496 rdev->sectors = le64_to_cpu(sb->sectors); in super_validate()
2498 rdev->recovery_offset = le64_to_cpu(sb->disk_recovery_offset); in super_validate()
2519 rdev->data_offset = le64_to_cpu(sb->data_offset); in super_validate()
2520 rdev->new_data_offset = le64_to_cpu(sb->new_data_offset); in super_validate()
3870 struct dm_raid_superblock *sb; in attempt_restore_of_faulty_devices() local
3936 sb = page_address(r->sb_page); in attempt_restore_of_faulty_devices()
3937 sb_retrieve_failed_devices(sb, failed_devices); in attempt_restore_of_faulty_devices()
3942 sb_update_failed_devices(sb, failed_devices); in attempt_restore_of_faulty_devices()