svn commit: r249135 - stable/9/sys/cam/scsi

Alexander Motin mav at FreeBSD.org
Fri Apr 5 09:02:05 UTC 2013


Author: mav
Date: Fri Apr  5 09:02:04 2013
New Revision: 249135
URL: http://svnweb.freebsd.org/changeset/base/249135

Log:
  MFC r237689 (by imp):
  Add a sysctl to set the cdrom timeout.  Data recovery operations from
  a CD or DVD drive with a damaged disc often benefit from a shorter
  timeout.  Also, when retries are set to 0, an application is expecting
  errors and recovering them so do not print the error into the log.
  The number of expected errors can literally be in the hundreds of
  thousands which significantly slows data recovery.

Modified:
  stable/9/sys/cam/scsi/scsi_cd.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/scsi/scsi_cd.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_cd.c	Fri Apr  5 08:51:05 2013	(r249134)
+++ stable/9/sys/cam/scsi/scsi_cd.c	Fri Apr  5 09:02:04 2013	(r249135)
@@ -293,6 +293,9 @@ PERIPHDRIVER_DECLARE(cd, cddriver);
 #ifndef	CD_DEFAULT_RETRY
 #define	CD_DEFAULT_RETRY	4
 #endif
+#ifndef	CD_DEFAULT_TIMEOUT
+#define	CD_DEFAULT_TIMEOUT	30000
+#endif
 #ifndef CHANGER_MIN_BUSY_SECONDS
 #define CHANGER_MIN_BUSY_SECONDS	5
 #endif
@@ -301,6 +304,7 @@ PERIPHDRIVER_DECLARE(cd, cddriver);
 #endif
 
 static int cd_retry_count = CD_DEFAULT_RETRY;
+static int cd_timeout = CD_DEFAULT_TIMEOUT;
 static int changer_min_busy_seconds = CHANGER_MIN_BUSY_SECONDS;
 static int changer_max_busy_seconds = CHANGER_MAX_BUSY_SECONDS;
 
@@ -310,6 +314,9 @@ static SYSCTL_NODE(_kern_cam_cd, OID_AUT
 SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW,
            &cd_retry_count, 0, "Normal I/O retry count");
 TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count);
+SYSCTL_INT(_kern_cam_cd, OID_AUTO, timeout, CTLFLAG_RW,
+	   &cd_timeout, 0, "Timeout, in us, for read operations");
+TUNABLE_INT("kern.cam.cd.timeout", &cd_timeout);
 SYSCTL_INT(_kern_cam_cd_changer, OID_AUTO, min_busy_seconds, CTLFLAG_RW,
 	   &changer_min_busy_seconds, 0, "Minimum changer scheduling quantum");
 TUNABLE_INT("kern.cam.cd.changer.min_busy_seconds", &changer_min_busy_seconds);
@@ -1505,8 +1512,9 @@ cdstart(struct cam_periph *periph, union
 					bp->bio_bcount / softc->params.blksize,
 					/* data_ptr */ bp->bio_data,
 					/* dxfer_len */ bp->bio_bcount,
-					/* sense_len */ SSD_FULL_SIZE,
-					/* timeout */ 30000);
+					/* sense_len */ cd_retry_count ?
+					  SSD_FULL_SIZE : SF_NO_PRINT,
+					/* timeout */ cd_timeout);
 			/* Use READ CD command for audio tracks. */
 			if (softc->params.blksize == 2352) {
 				start_ccb->csio.cdb_io.cdb_bytes[0] = READ_CD;


More information about the svn-src-stable-9 mailing list