According to http://www.torque.net/sg/p/sg_v3_ho.html, SG HOWTO, SG_[GET|SET]_TIMEOUTs are measured in "jiffies," while timeout field of SG_IO structure - in milliseconds. Inconsistent? Yes. Yet it's no excuse to disregard the specification. "Jiffies" are USER_HZ, 10ms on IA-32 platforms and has to be scaled to kernel "jiffies," as suggested below. As for "(jiffies - start_time) * (1000 / HZ)" vs. "((jiffies - start_time) * 1000) / HZ." Just think that HZ is 1024 on some platforms... This is relative to 2.5.69-70... --- ./drivers/block/scsi_ioctl.c.orig Mon May 5 01:53:57 2003 +++ ./drivers/block/scsi_ioctl.c Sat May 24 22:13:20 2003 @@ -92,7 +92,7 @@ static int sg_get_timeout(request_queue_t *q) { - return q->sg_timeout; + return q->sg_timeout/(HZ/USER_HZ); } static int sg_set_timeout(request_queue_t *q, int *p) @@ -100,7 +100,7 @@ int timeout, err = get_user(timeout, p); if (!err) - q->sg_timeout = timeout; + q->sg_timeout = timeout*(HZ/USER_HZ); return err; } @@ -241,7 +241,7 @@ rq->data_len = hdr.dxfer_len; rq->data = buffer; - rq->timeout = hdr.timeout; + rq->timeout = (hdr.timeout*HZ)/1000; if (!rq->timeout) rq->timeout = q->sg_timeout; if (!rq->timeout) @@ -268,7 +268,7 @@ if (hdr.masked_status || hdr.host_status || hdr.driver_status) hdr.info |= SG_INFO_CHECK; hdr.resid = rq->data_len; - hdr.duration = (jiffies - start_time) * (1000 / HZ); + hdr.duration = ((jiffies - start_time) * 1000) / HZ; hdr.sb_len_wr = 0; if (rq->sense_len && hdr.sbp) {