From owner-p4-projects@FreeBSD.ORG Tue Nov 10 13:16:08 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 289331065698; Tue, 10 Nov 2009 13:16:08 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C881F1065696 for ; Tue, 10 Nov 2009 13:16:07 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B639B8FC19 for ; Tue, 10 Nov 2009 13:16:07 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id nAADG7Pi079318 for ; Tue, 10 Nov 2009 13:16:07 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nAADG7lO079316 for perforce@freebsd.org; Tue, 10 Nov 2009 13:16:07 GMT (envelope-from mav@freebsd.org) Date: Tue, 10 Nov 2009 13:16:07 GMT Message-Id: <200911101316.nAADG7lO079316@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 170438 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 13:16:08 -0000 http://p4web.freebsd.org/chv.cgi?CH=170438 Change 170438 by mav@mav_mavbook on 2009/11/10 13:15:30 Wrap duplicate code into xpt_stop_tags(). Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#52 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#123 edit .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_internal.h#14 edit .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#24 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#52 (text+ko) ==== @@ -1379,24 +1379,7 @@ device->tag_delay_count = CAM_TAG_DELAY_COUNT; device->flags |= CAM_DEV_TAG_AFTER_COUNT; } else { - struct ccb_relsim crs; - - xpt_freeze_devq(cts->ccb_h.path, /*count*/1); - device->inq_flags &= ~SID_CmdQue; - xpt_dev_ccbq_resize(cts->ccb_h.path, - sim->max_dev_openings); - device->flags &= ~CAM_DEV_TAG_AFTER_COUNT; - device->tag_delay_count = 0; - - xpt_setup_ccb(&crs.ccb_h, cts->ccb_h.path, - CAM_PRIORITY_NORMAL); - crs.ccb_h.func_code = XPT_REL_SIMQ; - crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; - crs.openings - = crs.release_timeout - = crs.qfrozen_cnt - = 0; - xpt_action((union ccb *)&crs); + xpt_stop_tags(cts->ccb_h.path); } } } ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#123 (text+ko) ==== @@ -285,7 +285,6 @@ static xpt_busfunc_t xptsetasyncbusfunc; static cam_status xptregister(struct cam_periph *periph, void *arg); -static void xpt_start_tags(struct cam_path *path); static __inline int xpt_schedule_dev_allocq(struct cam_eb *bus, struct cam_ed *dev); static __inline int periph_is_queued(struct cam_periph *periph); @@ -4593,7 +4592,7 @@ return (device); } -static void +void xpt_start_tags(struct cam_path *path) { struct ccb_relsim crs; @@ -4622,6 +4621,30 @@ xpt_action((union ccb *)&crs); } +void +xpt_stop_tags(struct cam_path *path) +{ + struct ccb_relsim crs; + struct cam_ed *device; + struct cam_sim *sim; + + device = path->device; + sim = path->bus->sim; + device->flags &= ~CAM_DEV_TAG_AFTER_COUNT; + device->tag_delay_count = 0; + xpt_freeze_devq(path, /*count*/1); + device->inq_flags &= ~SID_CmdQue; + xpt_dev_ccbq_resize(path, sim->max_dev_openings); + xpt_setup_ccb(&crs.ccb_h, path, CAM_PRIORITY_NORMAL); + crs.ccb_h.func_code = XPT_REL_SIMQ; + crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; + crs.openings + = crs.release_timeout + = crs.qfrozen_cnt + = 0; + xpt_action((union ccb *)&crs); +} + static int busses_to_config; static int busses_to_reset; ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt_internal.h#14 (text+ko) ==== @@ -176,6 +176,8 @@ int xpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo, u_int32_t new_priority); u_int32_t xpt_dev_ccbq_resize(struct cam_path *path, int newopenings); +void xpt_start_tags(struct cam_path *path); +void xpt_stop_tags(struct cam_path *path); MALLOC_DECLARE(M_CAMXPT); ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#24 (text+ko) ==== @@ -2274,24 +2274,7 @@ device->tag_delay_count = CAM_TAG_DELAY_COUNT; device->flags |= CAM_DEV_TAG_AFTER_COUNT; } else { - struct ccb_relsim crs; - - xpt_freeze_devq(cts->ccb_h.path, /*count*/1); - device->inq_flags &= ~SID_CmdQue; - xpt_dev_ccbq_resize(cts->ccb_h.path, - sim->max_dev_openings); - device->flags &= ~CAM_DEV_TAG_AFTER_COUNT; - device->tag_delay_count = 0; - - xpt_setup_ccb(&crs.ccb_h, cts->ccb_h.path, - CAM_PRIORITY_NORMAL); - crs.ccb_h.func_code = XPT_REL_SIMQ; - crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY; - crs.openings - = crs.release_timeout - = crs.qfrozen_cnt - = 0; - xpt_action((union ccb *)&crs); + xpt_stop_tags(cts->ccb_h.path); } } }