Page MenuHomeFreeBSD

D44631.diff
No OneTemporary

D44631.diff

diff --git a/sys/kern/kern_osd.c b/sys/kern/kern_osd.c
--- a/sys/kern/kern_osd.c
+++ b/sys/kern/kern_osd.c
@@ -278,25 +278,34 @@
}
void *
-osd_get(u_int type, struct osd *osd, u_int slot)
+osd_get_unlocked(u_int type, struct osd *osd, u_int slot)
{
- struct rm_priotracker tracker;
void *value;
- KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
- KASSERT(slot > 0, ("Invalid slot."));
-
- rm_rlock(&osdm[type].osd_object_lock, &tracker);
KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot."));
if (slot > osd->osd_nslots) {
value = NULL;
OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
} else {
- value = osd->osd_slots[slot - 1];
+ value = atomic_load_ptr(&osd->osd_slots[slot - 1]);
OSD_DEBUG("Returning slot value (type=%u, slot=%u, value=%p).",
type, slot, value);
}
+ return (value);
+}
+
+void *
+osd_get(u_int type, struct osd *osd, u_int slot)
+{
+ struct rm_priotracker tracker;
+ void *value;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+ KASSERT(slot > 0, ("Invalid slot."));
+
+ rm_rlock(&osdm[type].osd_object_lock, &tracker);
+ value = osd_get_unlocked(type, osd, slot);
rm_runlock(&osdm[type].osd_object_lock, &tracker);
return (value);
}
diff --git a/sys/sys/osd.h b/sys/sys/osd.h
--- a/sys/sys/osd.h
+++ b/sys/sys/osd.h
@@ -64,6 +64,7 @@
void *value);
void osd_free_reserved(void **rsv);
void *osd_get(u_int type, struct osd *osd, u_int slot);
+void *osd_get_unlocked(u_int type, struct osd *osd, u_int slot);
void osd_del(u_int type, struct osd *osd, u_int slot);
int osd_call(u_int type, u_int method, void *obj, void *data);
@@ -79,6 +80,8 @@
osd_set_reserved(OSD_THREAD, &(td)->td_osd, (slot), (rsv), (value))
#define osd_thread_get(td, slot) \
osd_get(OSD_THREAD, &(td)->td_osd, (slot))
+#define osd_thread_get_unlocked(td, slot) \
+ osd_get_unlocked(OSD_THREAD, &(td)->td_osd, (slot))
#define osd_thread_del(td, slot) do { \
KASSERT((td) == curthread, ("Not curthread.")); \
osd_del(OSD_THREAD, &(td)->td_osd, (slot)); \
@@ -98,6 +101,8 @@
osd_set_reserved(OSD_JAIL, &(pr)->pr_osd, (slot), (rsv), (value))
#define osd_jail_get(pr, slot) \
osd_get(OSD_JAIL, &(pr)->pr_osd, (slot))
+#define osd_jail_get_unlocked(pr, slot) \
+ osd_get_unlocked(OSD_JAIL, &(pr)->pr_osd, (slot))
#define osd_jail_del(pr, slot) \
osd_del(OSD_JAIL, &(pr)->pr_osd, (slot))
#define osd_jail_call(pr, method, data) \

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 11:21 AM (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15753303
Default Alt Text
D44631.diff (2 KB)

Event Timeline