Lines Matching refs:vol
139 static int g_raid_tr_raid1e_select_read_disk(struct g_raid_volume *vol,
143 V2P(struct g_raid_volume *vol, off_t virt,
149 strip_size = vol->v_strip_size;
155 *disk = (nstrip * N) % vol->v_disks_count;
157 *offset = ((nstrip * N) / vol->v_disks_count) * strip_size;
161 P2V(struct g_raid_volume *vol, int disk, off_t offset,
167 strip_size = vol->v_strip_size;
171 nstrip = (offset / strip_size) * vol->v_disks_count + disk;
179 g_raid_tr_taste_raid1e(struct g_raid_tr_object *tr, struct g_raid_volume *vol)
192 g_raid_tr_update_state_raid1e_even(struct g_raid_volume *vol)
198 sc = vol->v_softc;
200 for (i = 0; i < vol->v_disks_count / N; i++) {
201 bestsd = &vol->v_subdisks[i * N];
203 sd = &vol->v_subdisks[i * N + j];
217 vol->v_name, bestsd->sd_pos,
222 vol, bestsd, bestsd->sd_disk);
224 worstsd = &vol->v_subdisks[i * N];
226 sd = &vol->v_subdisks[i * N + j];
245 g_raid_tr_update_state_raid1e_odd(struct g_raid_volume *vol)
251 sc = vol->v_softc;
252 if (g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_ACTIVE) ==
253 vol->v_disks_count)
255 for (i = 0; i < vol->v_disks_count; i++) {
256 sd = &vol->v_subdisks[i];
261 vol->v_name, sd->sd_pos,
265 g_raid_write_metadata(sc, vol, sd, sd->sd_disk);
269 for (i = 0; i < vol->v_disks_count; i++) {
270 bestsd = &vol->v_subdisks[i];
271 worstsd = &vol->v_subdisks[i];
273 sd = &vol->v_subdisks[(i + j) % vol->v_disks_count];
299 g_raid_tr_update_state_raid1e(struct g_raid_volume *vol,
306 sc = vol->v_softc;
307 trs = (struct g_raid_tr_raid1e_object *)vol->v_tr;
314 if ((vol->v_disks_count % N) == 0)
315 s = g_raid_tr_update_state_raid1e_even(vol);
317 s = g_raid_tr_update_state_raid1e_odd(vol);
319 if (s != vol->v_state) {
320 g_raid_event_send(vol, G_RAID_VOLUME_S_ALIVE(s) ?
323 g_raid_change_volume_state(vol, s);
325 g_raid_write_metadata(sc, vol, NULL, NULL);
328 g_raid_tr_raid1e_maybe_rebuild(vol->v_tr, sd);
336 struct g_raid_volume *vol;
338 vol = sd->sd_volume;
348 if ((g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_ACTIVE) +
349 g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_RESYNC) +
350 g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_STALE) +
351 g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_UNINITIALIZED) <
352 vol->v_disks_count) &&
361 struct g_raid_volume *vol;
364 vol = trs->trso_base.tro_volume;
366 g_raid_write_metadata(vol->v_softc, vol, sd, sd->sd_disk);
373 g_raid_tr_update_state_raid1e(vol, NULL);
398 struct g_raid_volume *vol;
400 vol = tr->tro_volume;
404 G_RAID_DEBUG1(1, vol->v_softc,
410 G_RAID_DEBUG1(0, vol->v_softc,
429 struct g_raid_volume *vol;
438 vol = tr->tro_volume;
439 sc = vol->v_softc;
448 P2V(vol, sd->sd_pos, sd->sd_rebuild_pos, &virtual, ©);
450 V2P(vol, virtual, &disk, &offset, &start);
454 if ((vol->v_disks_count % N) != 0)
455 len = MIN(len, vol->v_strip_size - start);
457 best = g_raid_tr_raid1e_select_read_disk(vol, disk,
476 ((disk + best >= vol->v_disks_count) ? vol->v_strip_size : 0);
481 bp->bio_caller1 = &vol->v_subdisks[(disk + best) % vol->v_disks_count];
487 if (start + len > vol->v_strip_size) {
488 P2V(vol, sd->sd_pos, sd->sd_rebuild_pos + len, &vend, ©);
502 struct g_raid_volume *vol;
506 vol = tr->tro_volume;
509 G_RAID_DEBUG1(1, vol->v_softc,
514 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_RESYNC);
516 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_REBUILD);
518 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_STALE);
523 g_raid_write_metadata(vol->v_softc, vol, sd, NULL);
525 sd = g_raid_get_subdisk(vol,
528 sd = g_raid_get_subdisk(vol,
534 g_raid_write_metadata(vol->v_softc,
535 vol, sd, NULL);
540 G_RAID_DEBUG1(1, vol->v_softc,
545 G_RAID_DEBUG1(0, vol->v_softc,
560 struct g_raid_volume *vol;
564 vol = tr->tro_volume;
568 nr = g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_REBUILD) +
569 g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_RESYNC);
572 if (vol->v_state < G_RAID_VOLUME_S_DEGRADED)
575 nr = g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_NEW) +
576 g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_STALE) +
577 g_raid_nsubdisks(vol, G_RAID_SUBDISK_S_UNINITIALIZED);
584 if (vol->v_state < G_RAID_VOLUME_S_DEGRADED || nr == 0 ||
606 struct g_raid_volume *vol;
609 vol = tr->tro_volume;
611 g_raid_tr_update_state_raid1e(vol, NULL);
619 struct g_raid_volume *vol;
622 vol = tr->tro_volume;
625 g_raid_tr_update_state_raid1e(vol, NULL);
635 g_raid_tr_raid1e_select_read_disk(struct g_raid_volume *vol,
645 sd = &vol->v_subdisks[(no + i) % vol->v_disks_count];
647 if (no + i >= vol->v_disks_count)
648 offset += vol->v_strip_size;
690 struct g_raid_volume *vol;
699 vol = tr->tro_volume;
704 strip_size = vol->v_strip_size;
705 V2P(vol, bp->bio_offset, &no, &offset, &start);
710 best = g_raid_tr_raid1e_select_read_disk(vol,
713 vol->v_name));
715 if (no >= vol->v_disks_count) {
716 no -= vol->v_disks_count;
732 cbp->bio_caller1 = &vol->v_subdisks[no];
735 if (no >= vol->v_disks_count) {
736 no -= vol->v_disks_count;
760 struct g_raid_volume *vol;
769 vol = tr->tro_volume;
774 strip_size = vol->v_strip_size;
775 V2P(vol, bp->bio_offset, &no, &offset, &start);
781 sd = &vol->v_subdisks[no];
811 if (++no >= vol->v_disks_count) {
838 struct g_raid_volume *vol;
841 vol = tr->tro_volume;
843 if (vol->v_state != G_RAID_VOLUME_S_OPTIMAL &&
844 vol->v_state != G_RAID_VOLUME_S_SUBOPTIMAL &&
845 vol->v_state != G_RAID_VOLUME_S_DEGRADED) {
878 bp->bio_cmd, vol->v_name));
889 struct g_raid_volume *vol;
897 vol = tr->tro_volume;
967 g_raid_write_metadata(vol->v_softc,
968 vol, nsd, nsd->sd_disk);
972 if ((vol->v_disks_count % N) != 0 &&
973 vol->v_strip_size <
978 vol->v_strip_size;
1024 P2V(vol, sd->sd_pos, bp->bio_offset, &virtual, ©);
1025 V2P(vol, virtual, &disk, &offset, &start);
1029 best = g_raid_tr_raid1e_select_read_disk(vol,
1033 if (disk >= vol->v_disks_count) {
1034 disk -= vol->v_disks_count;
1035 offset += vol->v_strip_size;
1044 nsd = &vol->v_subdisks[disk];
1076 P2V(vol, sd->sd_pos, bp->bio_offset, &virtual, ©);
1077 V2P(vol, virtual, &disk, &offset, &start);
1080 best = g_raid_tr_raid1e_select_read_disk(vol,
1084 if (disk >= vol->v_disks_count) {
1085 disk -= vol->v_disks_count;
1086 offset += vol->v_strip_size;
1095 g_raid_subdisk_iostart(&vol->v_subdisks[disk], cbp);
1111 P2V(vol, sd->sd_pos, bp->bio_offset, &virtual, ©);
1112 V2P(vol, virtual, &disk, &offset, &start);
1116 vol->v_subdisks[(disk + copy) %
1117 vol->v_disks_count].sd_recovery--;
1150 struct g_raid_volume *vol;
1158 vol = tr->tro_volume;
1160 strip_size = vol->v_strip_size;
1161 V2P(vol, boffset, &no, &offset, &start);
1167 sd = &vol->v_subdisks[no];
1185 if (++no >= vol->v_disks_count) {
1214 struct g_raid_volume *vol;
1216 vol = tr->tro_volume;
1221 if ((vol->v_disks_count % N) != 0 &&
1222 vol->v_strip_size < g_raid1e_rebuild_slab) {
1224 trs->trso_recover_slabs /= vol->v_strip_size;