Lines Matching refs:sd
131 struct g_raid_subdisk *sd);
149 struct g_raid_subdisk *sd) in g_raid_tr_update_state_raid1() argument
206 g_raid_tr_raid1_maybe_rebuild(vol->v_tr, sd); in g_raid_tr_update_state_raid1()
220 g_raid_tr_raid1_fail_disk(struct g_raid_softc *sc, struct g_raid_subdisk *sd, in g_raid_tr_raid1_fail_disk() argument
232 if (g_raid_nsubdisks(sd->sd_volume, G_RAID_SUBDISK_S_ACTIVE) == 1 && in g_raid_tr_raid1_fail_disk()
233 g_raid_get_subdisk(sd->sd_volume, G_RAID_SUBDISK_S_ACTIVE) == sd) in g_raid_tr_raid1_fail_disk()
235 g_raid_fail_disk(sc, sd, disk); in g_raid_tr_raid1_fail_disk()
242 struct g_raid_subdisk *sd, *good_sd; in g_raid_tr_raid1_rebuild_some() local
248 sd = trs->trso_failed_sd; in g_raid_tr_raid1_rebuild_some()
249 good_sd = g_raid_get_subdisk(sd->sd_volume, G_RAID_SUBDISK_S_ACTIVE); in g_raid_tr_raid1_rebuild_some()
256 bp->bio_offset = sd->sd_rebuild_pos; in g_raid_tr_raid1_rebuild_some()
258 sd->sd_size - sd->sd_rebuild_pos); in g_raid_tr_raid1_rebuild_some()
265 g_raid_lock_range(sd->sd_volume, /* Lock callback starts I/O */ in g_raid_tr_raid1_rebuild_some()
273 struct g_raid_subdisk *sd; in g_raid_tr_raid1_rebuild_done() local
276 sd = trs->trso_failed_sd; in g_raid_tr_raid1_rebuild_done()
277 g_raid_write_metadata(vol->v_softc, vol, sd, sd->sd_disk); in g_raid_tr_raid1_rebuild_done()
291 struct g_raid_subdisk *sd; in g_raid_tr_raid1_rebuild_finish() local
294 sd = trs->trso_failed_sd; in g_raid_tr_raid1_rebuild_finish()
297 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1_rebuild_finish()
298 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]"); in g_raid_tr_raid1_rebuild_finish()
299 g_raid_change_subdisk_state(sd, G_RAID_SUBDISK_S_ACTIVE); in g_raid_tr_raid1_rebuild_finish()
300 sd->sd_rebuild_pos = 0; in g_raid_tr_raid1_rebuild_finish()
308 struct g_raid_subdisk *sd; in g_raid_tr_raid1_rebuild_abort() local
314 sd = trs->trso_failed_sd; in g_raid_tr_raid1_rebuild_abort()
318 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1_rebuild_abort()
319 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]"); in g_raid_tr_raid1_rebuild_abort()
324 sd->sd_volume->v_name, sd->sd_pos, in g_raid_tr_raid1_rebuild_abort()
325 sd->sd_disk ? g_raid_get_diskname(sd->sd_disk) : "[none]"); in g_raid_tr_raid1_rebuild_abort()
330 sd->sd_size - sd->sd_rebuild_pos); in g_raid_tr_raid1_rebuild_abort()
332 sd->sd_rebuild_pos, len); in g_raid_tr_raid1_rebuild_abort()
343 struct g_raid_subdisk *sd, *fsd; in g_raid_tr_raid1_rebuild_start() local
353 sd = g_raid_get_subdisk(vol, G_RAID_SUBDISK_S_ACTIVE); in g_raid_tr_raid1_rebuild_start()
354 if (sd == NULL) { in g_raid_tr_raid1_rebuild_start()
403 struct g_raid_subdisk *sd) in g_raid_tr_raid1_maybe_rebuild() argument
436 if (na == 0 || nr == 0 || trs->trso_failed_sd == sd) in g_raid_tr_raid1_maybe_rebuild()
446 struct g_raid_subdisk *sd, u_int event) in g_raid_tr_event_raid1() argument
449 g_raid_tr_update_state_raid1(tr->tro_volume, sd); in g_raid_tr_event_raid1()
489 struct g_raid_subdisk *sd, *best; in g_raid_tr_raid1_select_read_disk() local
495 sd = &vol->v_subdisks[i]; in g_raid_tr_raid1_select_read_disk()
496 if (sd->sd_state != G_RAID_SUBDISK_S_ACTIVE && in g_raid_tr_raid1_select_read_disk()
497 ((sd->sd_state != G_RAID_SUBDISK_S_REBUILD && in g_raid_tr_raid1_select_read_disk()
498 sd->sd_state != G_RAID_SUBDISK_S_RESYNC) || in g_raid_tr_raid1_select_read_disk()
499 bp->bio_offset + bp->bio_length > sd->sd_rebuild_pos)) in g_raid_tr_raid1_select_read_disk()
503 prio = G_RAID_SUBDISK_LOAD(sd); in g_raid_tr_raid1_select_read_disk()
504 prio += min(sd->sd_recovery, 255) << 22; in g_raid_tr_raid1_select_read_disk()
505 prio += (G_RAID_SUBDISK_S_ACTIVE - sd->sd_state) << 16; in g_raid_tr_raid1_select_read_disk()
507 if (G_RAID_SUBDISK_POS(sd) == bp->bio_offset) in g_raid_tr_raid1_select_read_disk()
511 if (ABS(G_RAID_SUBDISK_POS(sd) - bp->bio_offset) < in g_raid_tr_raid1_select_read_disk()
515 best = sd; in g_raid_tr_raid1_select_read_disk()
525 struct g_raid_subdisk *sd; in g_raid_tr_iostart_raid1_read() local
528 sd = g_raid_tr_raid1_select_read_disk(tr->tro_volume, bp, 0); in g_raid_tr_iostart_raid1_read()
529 KASSERT(sd != NULL, ("No active disks in volume %s.", in g_raid_tr_iostart_raid1_read()
538 g_raid_subdisk_iostart(sd, cbp); in g_raid_tr_iostart_raid1_read()
545 struct g_raid_subdisk *sd; in g_raid_tr_iostart_raid1_write() local
558 sd = &vol->v_subdisks[i]; in g_raid_tr_iostart_raid1_write()
559 switch (sd->sd_state) { in g_raid_tr_iostart_raid1_write()
568 if (bp->bio_offset >= sd->sd_rebuild_pos) in g_raid_tr_iostart_raid1_write()
586 cbp->bio_caller1 = sd; in g_raid_tr_iostart_raid1_write()
590 sd = cbp->bio_caller1; in g_raid_tr_iostart_raid1_write()
592 g_raid_subdisk_iostart(sd, cbp); in g_raid_tr_iostart_raid1_write()
653 struct g_raid_subdisk *sd, struct bio *bp) in g_raid_tr_iodone_raid1() argument
723 g_raid_tr_raid1_fail_disk(sd->sd_softc, in g_raid_tr_iodone_raid1()
733 g_raid_unlock_range(sd->sd_volume, in g_raid_tr_iodone_raid1()
777 sd->sd_disk->d_read_errs++; in g_raid_tr_iodone_raid1()
780 bp->bio_error, sd->sd_disk->d_read_errs); in g_raid_tr_iodone_raid1()
789 if (sd->sd_disk->d_read_errs > g_raid_read_err_thresh) { in g_raid_tr_iodone_raid1()
790 g_raid_tr_raid1_fail_disk(sd->sd_softc, sd, sd->sd_disk); in g_raid_tr_iodone_raid1()
801 pbp->bio_driver1 = do_write ? sd : NULL; in g_raid_tr_iodone_raid1()
804 *mask |= 1 << sd->sd_pos; in g_raid_tr_iodone_raid1()
811 sd->sd_recovery++; in g_raid_tr_iodone_raid1()
815 g_raid_lock_range(sd->sd_volume, in g_raid_tr_iodone_raid1()
870 g_raid_tr_raid1_fail_disk(sd->sd_softc, sd, sd->sd_disk); in g_raid_tr_iodone_raid1()
878 g_raid_unlock_range(sd->sd_volume, bp->bio_offset, in g_raid_tr_iodone_raid1()
886 g_raid_tr_raid1_fail_disk(sd->sd_softc, sd, sd->sd_disk); in g_raid_tr_iodone_raid1()
903 struct g_raid_subdisk *sd; in g_raid_tr_kerneldump_raid1() local
910 sd = &vol->v_subdisks[i]; in g_raid_tr_kerneldump_raid1()
911 switch (sd->sd_state) { in g_raid_tr_kerneldump_raid1()
920 if (offset >= sd->sd_rebuild_pos) in g_raid_tr_kerneldump_raid1()
935 error = g_raid_subdisk_kerneldump(sd, virtual, offset, length); in g_raid_tr_kerneldump_raid1()
946 struct g_raid_subdisk *sd; in g_raid_tr_locked_raid1() local
949 sd = (struct g_raid_subdisk *)bp->bio_caller1; in g_raid_tr_locked_raid1()
950 g_raid_subdisk_iostart(sd, bp); in g_raid_tr_locked_raid1()