PERFORCE change 118009 for review
Scott Long
scottl at FreeBSD.org
Fri Apr 13 16:05:00 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=118009
Change 118009 by scottl at scottl-y1 on 2007/04/13 16:04:15
Add xpt_create_path_unlocked() to allow a non-wildcard path to be
created without needing the sim locked first.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#55 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#7 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#55 (text+ko) ====
@@ -4102,11 +4102,6 @@
struct cam_path *path;
cam_status status;
-#if 0
- if (perph != NULL)
- mtx_assert(perph->sim->mtx, MA_OWNED);
-#endif
-
path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_NOWAIT);
if (path == NULL) {
@@ -4122,6 +4117,36 @@
return (status);
}
+cam_status
+xpt_create_path_unlocked(struct cam_path **new_path_ptr,
+ struct cam_periph *periph, path_id_t path_id,
+ target_id_t target_id, lun_id_t lun_id)
+{
+ struct cam_path *path;
+ struct cam_eb *bus = NULL;
+ cam_status status;
+ int need_unlock = 0;
+
+ path = (struct cam_path *)malloc(sizeof(*path), M_CAMXPT, M_WAITOK);
+
+ if (path_id != CAM_BUS_WILDCARD) {
+ bus = xpt_find_bus(path_id);
+ if (bus != NULL) {
+ need_unlock = 1;
+ mtx_lock(bus->sim->mtx);
+ }
+ }
+ status = xpt_compile_path(path, periph, path_id, target_id, lun_id);
+ if (need_unlock)
+ mtx_unlock(bus->sim->mtx);
+ if (status != CAM_REQ_CMP) {
+ free(path, M_CAMXPT);
+ path = NULL;
+ }
+ *new_path_ptr = path;
+ return (status);
+}
+
static cam_status
xpt_compile_path(struct cam_path *new_path, struct cam_periph *perph,
path_id_t path_id, target_id_t target_id, lun_id_t lun_id)
==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.h#7 (text+ko) ====
@@ -58,6 +58,10 @@
struct cam_periph *perph,
path_id_t path_id,
target_id_t target_id, lun_id_t lun_id);
+cam_status xpt_create_path_unlocked(struct cam_path **new_path_ptr,
+ struct cam_periph *perph,
+ path_id_t path_id,
+ target_id_t target_id, lun_id_t lun_id);
void xpt_free_path(struct cam_path *path);
int xpt_path_comp(struct cam_path *path1,
struct cam_path *path2);
More information about the p4-projects
mailing list