Lines Matching defs:osd
42 #include <sys/osd.h>
56 LIST_HEAD(, osd) osd_list; /* (l) */
63 static MALLOC_DEFINE(M_OSD, "osd", "Object Specific Data");
66 SYSCTL_INT(_debug, OID_AUTO, osd, CTLFLAG_RWTUN, &osd_debug, 0, "OSD debug level");
76 static void do_osd_del(u_int type, struct osd *osd, u_int slot,
152 struct osd *osd, *tosd;
165 LIST_FOREACH_SAFE(osd, &osdm[type].osd_list, osd_next, tosd)
166 do_osd_del(type, osd, slot, 1);
185 osd_set(u_int type, struct osd *osd, u_int slot, void *value)
188 return (osd_set_reserved(type, osd, slot, NULL, value));
202 osd_set_reserved(u_int type, struct osd *osd, u_int slot, void **rsv,
213 if (slot > osd->osd_nslots) {
236 if (osd->osd_nslots != 0) {
237 memcpy(newptr, osd->osd_slots,
238 sizeof(void *) * osd->osd_nslots);
239 free(osd->osd_slots, M_OSD);
242 newptr = realloc(osd->osd_slots, sizeof(void *) * slot,
250 if (osd->osd_nslots == 0) {
256 LIST_INSERT_HEAD(&osdm[type].osd_list, osd, osd_next);
261 osd->osd_slots = newptr;
262 osd->osd_nslots = slot;
267 osd->osd_slots[slot - 1] = value;
281 osd_get_unlocked(u_int type, struct osd *osd, u_int slot)
287 if (slot > osd->osd_nslots) {
291 value = atomic_load_ptr(&osd->osd_slots[slot - 1]);
299 osd_get(u_int type, struct osd *osd, u_int slot)
308 value = osd_get_unlocked(type, osd, slot);
314 osd_del(u_int type, struct osd *osd, u_int slot)
319 do_osd_del(type, osd, slot, 0);
324 do_osd_del(u_int type, struct osd *osd, u_int slot, int list_locked)
334 if (slot > osd->osd_nslots) {
338 if (osd->osd_slots[slot - 1] != NULL) {
339 osdm[type].osd_destructors[slot - 1](osd->osd_slots[slot - 1]);
340 osd->osd_slots[slot - 1] = NULL;
342 for (i = osd->osd_nslots - 1; i >= 0; i--) {
343 if (osd->osd_slots[i] != NULL) {
354 LIST_REMOVE(osd, osd_next);
357 free(osd->osd_slots, M_OSD);
358 osd->osd_slots = NULL;
359 osd->osd_nslots = 0;
360 } else if (slot == osd->osd_nslots) {
362 osd->osd_slots = realloc(osd->osd_slots,
368 KASSERT(osd->osd_slots != NULL, ("realloc() failed"));
369 osd->osd_nslots = i + 1;
371 osd->osd_nslots, type);
404 osd_exit(u_int type, struct osd *osd)
411 if (osd->osd_nslots == 0) {
412 KASSERT(osd->osd_slots == NULL, ("Non-null osd_slots."));
418 for (i = 1; i <= osd->osd_nslots; i++) {
420 do_osd_del(type, osd, i, 0);
443 SYSINIT(osd, SI_SUB_LOCK, SI_ORDER_ANY, osd_init, NULL);