Lines Matching refs:osd

43 #include <sys/osd.h>
47 static MALLOC_DEFINE(M_OSD, "osd", "Object Specific Data");
50 TUNABLE_INT("debug.osd", &osd_debug);
51 SYSCTL_INT(_debug, OID_AUTO, osd, CTLFLAG_RW, &osd_debug, 0, "OSD debug level");
61 static void do_osd_del(u_int type, struct osd *osd, u_int slot,
72 static LIST_HEAD(, osd) osd_list[OSD_LAST + 1]; /* (m) */
150 struct osd *osd, *tosd;
162 LIST_FOREACH_SAFE(osd, &osd_list[type], osd_next, tosd)
163 do_osd_del(type, osd, slot, 1);
196 osd_set(u_int type, struct osd *osd, u_int slot, void *value)
205 if (slot > osd->osd_nslots) {
212 } else if (osd->osd_nslots == 0) {
217 osd->osd_slots = malloc(sizeof(void *) * slot, M_OSD,
219 if (osd->osd_slots == NULL) {
223 osd->osd_nslots = slot;
225 LIST_INSERT_HEAD(&osd_list[type], osd, osd_next);
235 newptr = realloc(osd->osd_slots, sizeof(void *) * slot,
241 osd->osd_slots = newptr;
242 osd->osd_nslots = slot;
248 osd->osd_slots[slot - 1] = value;
254 osd_get(u_int type, struct osd *osd, u_int slot)
264 if (slot > osd->osd_nslots) {
268 value = osd->osd_slots[slot - 1];
277 osd_del(u_int type, struct osd *osd, u_int slot)
282 do_osd_del(type, osd, slot, 0);
287 do_osd_del(u_int type, struct osd *osd, u_int slot, int list_locked)
297 if (slot > osd->osd_nslots) {
301 if (osd->osd_slots[slot - 1] != NULL) {
302 osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]);
303 osd->osd_slots[slot - 1] = NULL;
305 for (i = osd->osd_nslots - 1; i >= 0; i--) {
306 if (osd->osd_slots[i] != NULL) {
317 LIST_REMOVE(osd, osd_next);
320 free(osd->osd_slots, M_OSD);
321 osd->osd_slots = NULL;
322 osd->osd_nslots = 0;
323 } else if (slot == osd->osd_nslots) {
325 osd->osd_slots = realloc(osd->osd_slots,
331 KASSERT(osd->osd_slots != NULL, ("realloc() failed"));
332 osd->osd_nslots = i + 1;
334 osd->osd_nslots, type);
364 osd_exit(u_int type, struct osd *osd)
371 if (osd->osd_nslots == 0) {
372 KASSERT(osd->osd_slots == NULL, ("Non-null osd_slots."));
378 for (i = 1; i <= osd->osd_nslots; i++) {
380 do_osd_del(type, osd, i, 0);
403 SYSINIT(osd, SI_SUB_LOCK, SI_ORDER_ANY, osd_init, NULL);