Date: Tue, 10 Nov 2009 13:16:07 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 170438 for review Message-ID: <200911101316.nAADG7lO079316@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911101316.nAADG7lO079316>