addition of an XPT_SCAN_TGT code

Kenneth D. Merry ken at kdm.org
Mon May 17 03:20:41 UTC 2010


On Fri, May 14, 2010 at 18:15:41 -0700, Matthew Jacob wrote:
> Sometimes, particularly in relation to a hotplug event, you just want to 
> scan a target id, not the whole bus. It's lighter weight.
> 
> The attached patch adds this with a relatively light touch. I'm not 
> super happy with it, but it does make rescanning on a target basis doable.
> 
> Comments?

Looks good, good idea!  Just two comments:

> diff -r 85c0fa25a2fc sys/cam/cam_ccb.h
> --- a/sys/cam/cam_ccb.h	Fri May 14 15:55:34 2010 -0700
> +++ b/sys/cam/cam_ccb.h	Fri May 14 18:14:46 2010 -0700
> @@ -207,6 +207,10 @@
>  				/* Notify Host Target driver of event */
>  	XPT_NOTIFY_ACKNOWLEDGE	= 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
>  				/* Acknowledgement of event */
> +/* overflow commands: 0x40 ->0x4F */
> +	XPT_SCAN_TGT		= 0x40 | XPT_FC_QUEUED | XPT_FC_USER_CCB
> +				       | XPT_FC_XPT_ONLY,
> +				/* (Re)Scan the SCSI Bus */
>  

Perhaps this would be better put at 0x1e?  XPT_SCAN_LUN is in the same
group, and this is similar.

> diff -r 85c0fa25a2fc sys/dev/isp/isp_freebsd.c
> --- a/sys/dev/isp/isp_freebsd.c	Fri May 14 15:55:34 2010 -0700
> +++ b/sys/dev/isp/isp_freebsd.c	Fri May 14 18:14:46 2010 -0700
> @@ -3898,7 +3898,7 @@
>  	 * Scan the whole bus instead of target, which will then
>  	 * force a scan of all luns.
>  	 */
> -	if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(fc->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
> +	if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(fc->sim), tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
>  		isp_prt(isp, ISP_LOGWARN, "unable to create path for rescan");
>  		xpt_free_ccb(ccb);
>  		return;

The comment above should probably be updated.

Ken
-- 
Kenneth Merry
ken at kdm.org


More information about the freebsd-scsi mailing list