Lines Matching refs:sd
135 struct g_raid_subdisk *sd);
192 struct g_raid_subdisk *sd, *bestsd, *worstsd; in g_raid_tr_update_state_raid1e_even() local
200 sd = &vol->v_subdisks[i * N + j]; in g_raid_tr_update_state_raid1e_even()
201 if (sd->sd_state > bestsd->sd_state) in g_raid_tr_update_state_raid1e_even()
202 bestsd = sd; in g_raid_tr_update_state_raid1e_even()
203 else if (sd->sd_state == bestsd->sd_state && in g_raid_tr_update_state_raid1e_even()
204 (sd->sd_state == G_RAID_SUBDISK_S_REBUILD || in g_raid_tr_update_state_raid1e_even()
205 sd->sd_state == G_RAID_SUBDISK_S_RESYNC) && in g_raid_tr_update_state_raid1e_even()
206 sd->sd_rebuild_pos > bestsd->sd_rebuild_pos) in g_raid_tr_update_state_raid1e_even()
207 bestsd = sd; in g_raid_tr_update_state_raid1e_even()
223 sd = &vol->v_subdisks[i * N + j]; in g_raid_tr_update_state_raid1e_even()
224 if (sd->sd_state < worstsd->sd_state) in g_raid_tr_update_state_raid1e_even()
225 worstsd = sd; in g_raid_tr_update_state_raid1e_even()
245 struct g_raid_subdisk *sd, *bestsd, *worstsd; in g_raid_tr_update_state_raid1e_odd() local
253 sd = &vol->v_subdisks[i]; in g_raid_tr_update_state_raid1e_odd()
254 if (sd->sd_state == G_RAID_SUBDISK_S_UNINITIALIZED) { in g_raid_tr_update_state_raid1e_odd()
258 vol->v_name, sd->sd_pos, in g_raid_tr_update_state_raid1e_odd()
259 g_raid_subdisk_state2str(sd->sd_state)); in g_raid_tr_update_state_raid1e_odd()
260 g_raid_change_subdisk_state(sd, in g_raid_tr_update_state_raid1e_odd()
262 g_raid_write_metadata(sc, vol, sd, sd->sd_disk); in g_raid_tr_update_state_raid1e_odd()
270 sd = &vol->v_subdisks[(i + j) % vol->v_disks_count]; in g_raid_tr_update_state_raid1e_odd()
271 if (sd->sd_state > bestsd->sd_state) in g_raid_tr_update_state_raid1e_odd()
272 bestsd = sd; in g_raid_tr_update_state_raid1e_odd()
273 else if (sd->sd_state == bestsd->sd_state && in g_raid_tr_update_state_raid1e_odd()
274 (sd->sd_state == G_RAID_SUBDISK_S_REBUILD || in g_raid_tr_update_state_raid1e_odd()
275 sd->sd_state == G_RAID_SUBDISK_S_RESYNC) && in g_raid_tr_update_state_raid1e_odd()
276 sd->sd_rebuild_pos > bestsd->sd_rebuild_pos) in g_raid_tr_update_state_raid1e_odd()
277 bestsd = sd; in g_raid_tr_update_state_raid1e_odd()
278 if (sd->sd_state < worstsd->sd_state) in g_raid_tr_update_state_raid1e_odd()
279 worstsd = sd; in g_raid_tr_update_state_raid1e_odd()
297 struct g_raid_subdisk *sd) in g_raid_tr_update_state_raid1e() argument
325 g_raid_tr_raid1e_maybe_rebuild(vol->v_tr, sd); in g_raid_tr_update_state_raid1e()
330 g_raid_tr_raid1e_fail_disk(struct g_raid_softc *sc, struct g_raid_subdisk *sd, in g_raid_tr_raid1e_fail_disk() argument
335 vol = sd->sd_volume; in g_raid_tr_raid1e_fail_disk()
350 (sd->sd_state >= G_RAID_SUBDISK_S_UNINITIALIZED)) in g_raid_tr_raid1e_fail_disk()
352 g_raid_fail_disk(sc, sd, disk); in g_raid_tr_raid1e_fail_disk()
359 struct g_raid_subdisk *sd; in g_raid_tr_raid1e_rebuild_done() local
362 sd = trs->trso_failed_sd; in g_raid_tr_raid1e_rebuild_done()
363 g_raid_write_metadata(vol->v_softc, vol, sd, sd->sd_disk); in g_raid_tr_raid1e_rebuild_done()
377 struct g_raid_subdisk *sd; in g_raid_tr_raid1e_rebuild_finish() local
380 sd = trs->trso_failed_sd; in g_raid_tr_raid1e_rebuild_finish()
383 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1e_rebuild_finish()
384 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]"); in g_raid_tr_raid1e_rebuild_finish()
385 g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_ACTIVE); in g_raid_tr_raid1e_rebuild_finish()
386 sd->sd_rebuild_pos = 0; in g_raid_tr_raid1e_rebuild_finish()
394 struct g_raid_subdisk *sd; in g_raid_tr_raid1e_rebuild_abort() local
399 sd = trs->trso_failed_sd; in g_raid_tr_raid1e_rebuild_abort()
403 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1e_rebuild_abort()
404 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]"); in g_raid_tr_raid1e_rebuild_abort()
409 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1e_rebuild_abort()
410 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]"); in g_raid_tr_raid1e_rebuild_abort()
427 struct g_raid_subdisk *sd; in g_raid_tr_raid1e_rebuild_some() local
437 sd = trs->trso_failed_sd; in g_raid_tr_raid1e_rebuild_some()
440 if (sd->sd_rebuild_pos >= sd->sd_size) { in g_raid_tr_raid1e_rebuild_some()
445 P2V(vol, sd->sd_pos, sd->sd_rebuild_pos, &virtual, ©); in g_raid_tr_raid1e_rebuild_some()
450 sd->sd_size - sd->sd_rebuild_pos); in g_raid_tr_raid1e_rebuild_some()
466 sd->sd_rebuild_pos, sd->sd_rebuild_pos + len); in g_raid_tr_raid1e_rebuild_some()
467 sd->sd_rebuild_pos += len; in g_raid_tr_raid1e_rebuild_some()
485 P2V(vol, sd->sd_pos, sd->sd_rebuild_pos + len, &vend, ©); in g_raid_tr_raid1e_rebuild_some()
493 g_raid_lock_range(sd->sd_volume, virtual, len, NULL, bp); in g_raid_tr_raid1e_rebuild_some()
501 struct g_raid_subdisk *sd; in g_raid_tr_raid1e_rebuild_start() local
511 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_RESYNC); in g_raid_tr_raid1e_rebuild_start()
512 if (sd == NULL) in g_raid_tr_raid1e_rebuild_start()
513 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_REBUILD); in g_raid_tr_raid1e_rebuild_start()
514 if (sd == NULL) { in g_raid_tr_raid1e_rebuild_start()
515 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_STALE); in g_raid_tr_raid1e_rebuild_start()
516 if (sd != NULL) { in g_raid_tr_raid1e_rebuild_start()
517 sd->sd_rebuild_pos = 0; in g_raid_tr_raid1e_rebuild_start()
518 g_raid_change_subdisk_state(sd, in g_raid_tr_raid1e_rebuild_start()
520 g_raid_write_metadata(vol->v_softc, vol, sd, NULL); in g_raid_tr_raid1e_rebuild_start()
522 sd = g_raid_get_subdisk(vol, in g_raid_tr_raid1e_rebuild_start()
524 if (sd == NULL) in g_raid_tr_raid1e_rebuild_start()
525 sd = g_raid_get_subdisk(vol, in g_raid_tr_raid1e_rebuild_start()
527 if (sd != NULL) { in g_raid_tr_raid1e_rebuild_start()
528 sd->sd_rebuild_pos = 0; in g_raid_tr_raid1e_rebuild_start()
529 g_raid_change_subdisk_state(sd, in g_raid_tr_raid1e_rebuild_start()
532 vol, sd, NULL); in g_raid_tr_raid1e_rebuild_start()
536 if (sd == NULL) { in g_raid_tr_raid1e_rebuild_start()
541 trs->trso_failed_sd = sd; in g_raid_tr_raid1e_rebuild_start()
544 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1e_rebuild_start()
545 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]", in g_raid_tr_raid1e_rebuild_start()
555 struct g_raid_subdisk *sd) in g_raid_tr_raid1e_maybe_rebuild() argument
582 trs->trso_failed_sd == sd) in g_raid_tr_raid1e_maybe_rebuild()
592 struct g_raid_subdisk *sd, u_int event) in g_raid_tr_event_raid1e() argument
595 g_raid_tr_update_state_raid1e(tr->tro_volume, sd); in g_raid_tr_event_raid1e()
635 struct g_raid_subdisk *sd; in g_raid_tr_raid1e_select_read_disk() local
642 sd = &vol->v_subdisks[(no + i) % vol->v_disks_count]; in g_raid_tr_raid1e_select_read_disk()
647 prio = G_RAID_SUBDISK_LOAD(sd); in g_raid_tr_raid1e_select_read_disk()
648 if ((mask & (1 << sd->sd_pos)) != 0) in g_raid_tr_raid1e_select_read_disk()
650 switch (sd->sd_state) { in g_raid_tr_raid1e_select_read_disk()
654 if (offset + off < sd->sd_rebuild_pos) in g_raid_tr_raid1e_select_read_disk()
661 if (offset + off < sd->sd_rebuild_pos) in g_raid_tr_raid1e_select_read_disk()
667 prio += min(sd->sd_recovery, 255) << 16; in g_raid_tr_raid1e_select_read_disk()
669 if (G_RAID_SUBDISK_POS(sd) == offset) in g_raid_tr_raid1e_select_read_disk()
673 if (ABS(G_RAID_SUBDISK_POS(sd) - offset) < in g_raid_tr_raid1e_select_read_disk()
688 struct g_raid_subdisk *sd; in g_raid_tr_iostart_raid1e_read() local
741 sd = cbp->bio_caller1; in g_raid_tr_iostart_raid1e_read()
743 g_raid_subdisk_iostart(sd, cbp); in g_raid_tr_iostart_raid1e_read()
758 struct g_raid_subdisk *sd; in g_raid_tr_iostart_raid1e_write() local
778 sd = &vol->v_subdisks[no]; in g_raid_tr_iostart_raid1e_write()
779 switch (sd->sd_state) { in g_raid_tr_iostart_raid1e_write()
785 if (offset + start >= sd->sd_rebuild_pos) in g_raid_tr_iostart_raid1e_write()
805 cbp->bio_caller1 = sd; in g_raid_tr_iostart_raid1e_write()
819 sd = cbp->bio_caller1; in g_raid_tr_iostart_raid1e_write()
821 g_raid_subdisk_iostart(sd, cbp); in g_raid_tr_iostart_raid1e_write()
882 struct g_raid_subdisk *sd, struct bio *bp) in g_raid_tr_iodone_raid1e() argument
939 g_raid_tr_raid1e_fail_disk(sd->sd_softc, in g_raid_tr_iodone_raid1e()
1003 sd->sd_disk->d_read_errs++; in g_raid_tr_iodone_raid1e()
1006 bp->bio_error, sd->sd_disk->d_read_errs); in g_raid_tr_iodone_raid1e()
1015 if (sd->sd_disk->d_read_errs > g_raid_read_err_thresh) in g_raid_tr_iodone_raid1e()
1016 g_raid_tr_raid1e_fail_disk(sd->sd_softc, sd, sd->sd_disk); in g_raid_tr_iodone_raid1e()
1021 P2V(vol, sd->sd_pos, bp->bio_offset, &virtual, ©); in g_raid_tr_iodone_raid1e()
1047 sd->sd_recovery++; in g_raid_tr_iodone_raid1e()
1052 g_raid_lock_range(sd->sd_volume, in g_raid_tr_iodone_raid1e()
1073 P2V(vol, sd->sd_pos, bp->bio_offset, &virtual, ©); in g_raid_tr_iodone_raid1e()
1108 P2V(vol, sd->sd_pos, bp->bio_offset, &virtual, ©); in g_raid_tr_iodone_raid1e()
1120 g_raid_tr_raid1e_fail_disk(sd->sd_softc, sd, sd->sd_disk); in g_raid_tr_iodone_raid1e()
1124 g_raid_unlock_range(sd->sd_volume, virtual, bp->bio_length); in g_raid_tr_iodone_raid1e()
1131 g_raid_tr_raid1e_fail_disk(sd->sd_softc, sd, sd->sd_disk); in g_raid_tr_iodone_raid1e()
1148 struct g_raid_subdisk *sd; in g_raid_tr_kerneldump_raid1e() local
1164 sd = &vol->v_subdisks[no]; in g_raid_tr_kerneldump_raid1e()
1165 switch (sd->sd_state) { in g_raid_tr_kerneldump_raid1e()
1171 if (offset + start >= sd->sd_rebuild_pos) in g_raid_tr_kerneldump_raid1e()
1177 error = g_raid_subdisk_kerneldump(sd, addr, in g_raid_tr_kerneldump_raid1e()
1198 struct g_raid_subdisk *sd; in g_raid_tr_locked_raid1e() local
1201 sd = (struct g_raid_subdisk *)bp->bio_caller1; in g_raid_tr_locked_raid1e()
1202 g_raid_subdisk_iostart(sd, bp); in g_raid_tr_locked_raid1e()