diff options
author | Matt Jacob <mjacob@FreeBSD.org> | 2005-01-22 22:46:45 +0000 |
---|---|---|
committer | Matt Jacob <mjacob@FreeBSD.org> | 2005-01-22 22:46:45 +0000 |
commit | f4322bc884b788ff03e751bc86ec9526afb03c37 (patch) | |
tree | aac3b3521b4874ec52212dd10b6ff5feeb96ec6b /sys | |
parent | 20ef44d42350588fdb1848e4c2a794388cf7bc17 (diff) | |
download | src-f4322bc884b788ff03e751bc86ec9526afb03c37.tar.gz src-f4322bc884b788ff03e751bc86ec9526afb03c37.zip |
This is a somewhat imperfect means to try and bring FreeBSD forward in
its ability to automatically scan and attach luns for modern storage
which has luns in the 0..1000 range, not 0..7.
The correct thing would be to do REPORT LUNS for devices whose LUN0
version shows a version >= SCSI3, but lacking that we should be able
to search higher than LUN 7 if we're >= SCSI3 with no ill effects.
This change keeps all of the QUIRK_HILUNS quirks, obeys the QUIRK_NOLUNS,
and introduces a QUIRK_NOHILUNS which will keep searches above LUN 7
happening for devices that report >= SCSI3 compliance. I doubt the latter
will be needed, but you never know.
This allowed me to randomly scan and attach > 500 disks at a time in
a situation where quirking for QUIRK_HILUNS wasn't practical (the
vendor id and product id changes of the virtualization changes
constantly).
Reviewed by: ken@freebsd.org, scottl@freebsd.org, gibbs@freebsd.org
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=140644
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/cam_xpt.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 84c8f2a14336..29b836d16847 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -199,10 +199,20 @@ struct xpt_quirk_entry { #define CAM_QUIRK_NOLUNS 0x01 #define CAM_QUIRK_NOSERIAL 0x02 #define CAM_QUIRK_HILUNS 0x04 +#define CAM_QUIRK_NOHILUNS 0x08 u_int mintags; u_int maxtags; }; #define CAM_SCSI2_MAXLUN 8 +/* + * If we're not quirked to search <= the first 8 luns + * and we are either quirked to search above lun 8, + * or we're > SCSI-2, we can look for luns above lun 8. + */ +#define CAN_SRCH_HI(dv) \ + (((dv->quirk->quirks & CAM_QUIRK_NOHILUNS) == 0) \ + && ((dv->quirk->quirks & CAM_QUIRK_HILUNS) \ + || SID_ANSI_REV(&dv->inq_data) > SCSI_REV_2)) typedef enum { XPT_FLAG_OPEN = 0x01 @@ -5294,7 +5304,7 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) s = splcam(); device = TAILQ_FIRST(&target->ed_entries); if (device != NULL) { - phl = device->quirk->quirks & CAM_QUIRK_HILUNS; + phl = CAN_SRCH_HI(device); if (device->lun_id == 0) device = TAILQ_NEXT(device, links); } @@ -5310,8 +5320,8 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) if ((device->quirk->quirks & CAM_QUIRK_NOLUNS) == 0) { /* Try the next lun */ - if (lun_id < (CAM_SCSI2_MAXLUN-1) || - (device->quirk->quirks & CAM_QUIRK_HILUNS)) + if (lun_id < (CAM_SCSI2_MAXLUN-1) + || CAN_SRCH_HI(device)) lun_id++; } } |