From owner-p4-projects@FreeBSD.ORG Fri Apr 13 16:05:00 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 12CE116A40A; Fri, 13 Apr 2007 16:05:00 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8F6D16A408 for ; Fri, 13 Apr 2007 16:04:59 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id C8DF913C4CA for ; Fri, 13 Apr 2007 16:04:59 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l3DG4xEl077388 for ; Fri, 13 Apr 2007 16:04:59 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l3DG4xoi077385 for perforce@freebsd.org; Fri, 13 Apr 2007 16:04:59 GMT (envelope-from scottl@freebsd.org) Date: Fri, 13 Apr 2007 16:04:59 GMT Message-Id: <200704131604.l3DG4xoi077385@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 118009 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2007 16:05:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=118009 Change 118009 by scottl@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);