Lines Matching defs:hs
68 set_hot_spare_state(hot_spare_t *hs, hotspare_states_t newstate)
70 hs->hs_state = newstate;
71 uniqtime32(&hs->hs_timestamp);
77 hot_spare_t *hs;
79 for (hs = (hot_spare_t *)md_set[setno].s_hs; hs; hs = hs->hs_next) {
80 if (hs->hs_record_id == hs_id)
81 return (hs);
160 hot_spare_t *hs;
193 hs = (hot_spare_t *)md_set[setno].s_hs;
194 while (hs) {
195 if (hs->hs_devnum == shs->shs_component_old) {
198 hs = hs->hs_next;
201 if (hs == NULL) {
235 hs = (hot_spare_t *)md_set[setno].s_hs;
236 while (hs) {
240 if ((hs->hs_devnum == NODEV64) &&
241 (hs->hs_key == key_old)) {
244 hs = hs->hs_next;
248 if (hs == NULL) {
270 hs = (hot_spare_t *)mddb_getrecaddr_resize(recid, sizeof (*hs),
273 hs->hs_record_id = recid;
275 hs->hs_devnum = shs->shs_component_old;
276 hs->hs_key = shs->shs_key_old;
277 hs->hs_start_blk = shs->shs_start_blk;
278 hs->hs_has_label = shs->shs_has_label;
279 hs->hs_number_blks = shs->shs_number_blks;
280 set_hot_spare_state(hs, HSS_AVAILABLE);
281 hs->hs_refcount = 0;
282 hs->hs_next = (hot_spare_t *)md_set[setno].s_hs;
283 md_set[setno].s_hs = (void *) hs;
335 if (hsp->hsp_hotspares[i] == hs->hs_record_id) {
338 hs->hs_devnum));
342 * This gives us the one extra hs slot,
397 hs->hs_revision |= MD_64BIT_META_DEV;
399 hs->hs_revision &= ~MD_64BIT_META_DEV;
403 recids[0] = hs->hs_record_id;
411 hs->hs_refcount++;
413 /* add the hs at the end of the hot spare pool */
414 hsp->hsp_hotspares[hsp->hsp_nhotspares] = hs->hs_record_id;
515 hot_spare_t *hs;
534 hs = (hot_spare_t *)md_set[setno].s_hs;
536 while (hs) {
537 if (hs->hs_devnum == shs->shs_component_old) {
540 prev_hs = hs;
541 hs = hs->hs_next;
544 if (hs == NULL) {
579 hs = (hot_spare_t *)md_set[setno].s_hs;
581 while (hs) {
585 if ((hs->hs_devnum == NODEV64) &&
586 (hs->hs_key == key_old)) {
589 prev_hs = hs;
590 hs = hs->hs_next;
594 if (hs == NULL) {
608 (hs->hs_state == HSS_RESERVED)) {
613 if (hsp->hsp_refcount && (hs->hs_state == HSS_RESERVED)) {
622 if (hsp->hsp_hotspares[i] == hs->hs_record_id) {
629 hs->hs_devnum));
638 recids[0] = hs->hs_record_id;
643 sv.key = hs->hs_key;
645 hs->hs_refcount--;
646 if (hs->hs_refcount == 0) {
652 prev_hs->hs_next = hs->hs_next;
654 md_set[setno].s_hs = (void *) hs->hs_next;
662 /* find the location of the hs in the hsp */
664 if (hsp->hsp_hotspares[i] == hs->hs_record_id)
668 /* remove the hs from the hsp */
678 mddb_deleterec_wrapper(hs->hs_record_id);
691 hot_spare_t *hs;
711 hs = (hot_spare_t *)md_set[setno].s_hs;
713 while (hs) {
714 if (hs->hs_devnum == shs->shs_component_old) {
717 prev_hs = hs;
718 hs = hs->hs_next;
721 if (hs == NULL) {
755 hs = (hot_spare_t *)md_set[setno].s_hs;
757 while (hs) {
761 if ((hs->hs_devnum == NODEV64) &&
762 (hs->hs_key == key_old)) {
765 prev_hs = hs;
766 hs = hs->hs_next;
770 if (hs == NULL) {
777 (hs->hs_state == HSS_RESERVED)) {
780 hs->hs_devnum));
794 if (hsp->hsp_hotspares[i] == hs->hs_record_id) {
800 hs->hs_devnum));
803 /* Scan the hot spare list for the new hs */
816 * We don't have to search the hs in this hsp, if the
817 * new hs was just created. Only if the hot spare was found.
873 recids[0] = hs->hs_record_id;
879 sv.key = hs->hs_key;
881 hs->hs_refcount--;
882 if (hs->hs_refcount == 0) {
888 prev_hs->hs_next = hs->hs_next;
890 md_set[setno].s_hs = (void *) hs->hs_next;
892 /* mark hs to be deleted in the correct order */
900 /* link into the hs list */
908 /* find the location of the old hs in the hsp */
910 if (hsp->hsp_hotspares[i] == hs->hs_record_id) {
926 mddb_deleterec_wrapper(hs->hs_record_id);
938 hot_spare_t *hs;
977 /* Scan the hot spare list for the hs */
978 hs = (hot_spare_t *)md_set[setno].s_hs;
979 while (hs) {
984 if (hs->hs_key == key_old) {
987 hs = hs->hs_next;
990 if (hs == NULL) {
996 if (hs->hs_state != HSS_BROKEN) {
998 hs->hs_devnum));
1007 set_hot_spare_state(hs, HSS_AVAILABLE);
1008 hs->hs_start_blk = shs->shs_start_blk;
1009 hs->hs_has_label = shs->shs_has_label;
1010 hs->hs_number_blks = shs->shs_number_blks;
1013 recids[0] = hs->hs_record_id;
1027 hot_spare_t *hs;
1032 /* Scan the hot spare list for the hs */
1033 hs = (hot_spare_t *)md_set[setno].s_hs;
1034 while (hs) {
1035 if (hs->hs_key == ghs->ghs_key) {
1038 hs = hs->hs_next;
1041 if (hs == NULL) {
1046 ghs->ghs_start_blk = hs->hs_start_blk;
1047 ghs->ghs_number_blks = hs->hs_number_blks;
1048 ghs->ghs_state = hs->hs_state;
1049 ghs->ghs_timestamp = hs->hs_timestamp;
1050 ghs->ghs_revision = hs->hs_revision;
1060 hot_spare_t *hs;
1061 hs = lookup_hot_spare(setno, hsp->hsp_hotspares[i], 1);
1062 list[i] = hs->hs_key;
1276 hot_spare_t *hs;
1301 hs = b_hs;
1305 hs = (hot_spare_t *)mddb_getrecaddr_resize
1306 (recid, sizeof (*hs), 0);
1309 MDDB_NOTE_FN(rbp->rb_revision, hs->hs_revision);
1312 if (hs->hs_revision & MD_64BIT_META_DEV) {
1315 set_hot_spare_state(hs, HSS_BROKEN);
1316 (void) md_devname(setno, hs->hs_devnum, devname,
1323 ASSERT(hs != NULL);
1325 if (hs->hs_refcount == 0) {
1330 hs->hs_next = (hot_spare_t *)md_set[setno].s_hs;
1331 md_set[setno].s_hs = (void *)hs;
1333 hs->hs_isopen = 0;
1335 hs->hs_devnum = md_getdevnum(setno, mddb_getsidenum(setno),
1336 hs->hs_key, MD_NOTRUST_DEVT);
1419 hot_spare_t *hs, **p_hs;
1441 hs = (hot_spare_t *)md_set[setno].s_hs;
1442 for (; hs != NULL; hs = *p_hs)
1443 *p_hs = hs->hs_next;
1470 hot_spare_t *hs;
1472 hs = lookup_hot_spare(setno, hs_id, 1);
1474 if (hs->hs_state != HSS_AVAILABLE)
1477 if (labeled && hs->hs_has_label && (hs->hs_number_blks >= nblks)) {
1479 return (hs);
1480 } else if ((hs->hs_number_blks - hs->hs_start_blk) >= nblks) {
1481 *start = hs->hs_start_blk;
1482 return (hs);
1499 hot_spare_t *hs;
1509 hs = usable_hs(setno, hsp->hsp_hotspares[i],
1511 if (hs == NULL)
1514 set_hot_spare_state(hs, HSS_RESERVED);
1515 *hs_id = hs->hs_record_id;
1516 *key = hs->hs_key;
1517 *dev = hs->hs_devnum;
1518 /* NOTE: Mirror code commits the hs record */
1538 hot_spare_t *hs;
1543 * That is because we always allocate the whole hs.
1555 hs = lookup_hot_spare(setno, hsp->hsp_hotspares[i], 1);
1556 if (hs->hs_key != key)
1559 set_hot_spare_state(hs, new_state);
1560 *hs_id = hs->hs_record_id;
1563 setno, hs->hs_devnum);
1567 setno, hs->hs_devnum);
1570 /* NOTE: Mirror/Raid code commits the hs record */
1607 hot_spare_t *hs;
1609 hs = lookup_hot_spare(mddb_getsetnum(hs_id), hs_id, 0);
1610 if (hs == NULL)
1613 *dev = hs->hs_devnum;