Package: kernel-patch-scsi-idle
Severity: wishlist
Tags: patch

Please include this patch for kernel 2.6. This should apply for
kernels 2.6.12--2.6.15 at least.

This patch is from the nslu2-linux project.

Thanks,

Marcus

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)

===File ~/scsi-idle.patch===================================
diff -ur linux-2.6.12.2/drivers/scsi/sd.c 
linux-2.6.12.2_scsi-idle/drivers/scsi/sd.c
--- linux-2.6.12.2/drivers/scsi/sd.c    2005-08-27 06:12:31.000000000 +0200
+++ linux-2.6.12.2_scsi-idle/drivers/scsi/sd.c  2005-08-27 06:26:50.000000000 
+0200
@@ -266,6 +266,9 @@
                            "count=%d\n", disk->disk_name,
                         (unsigned long long)block, this_count));
 
+       /* Update idle-since time */
+       sdp->idle = jiffies;
+
        if (!sdp || !scsi_device_online(sdp) ||
            block + rq->nr_sectors > get_capacity(disk)) {
                SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n", 
@@ -600,6 +603,8 @@
                case SCSI_IOCTL_GET_IDLUN:
                case SCSI_IOCTL_GET_BUS_NUMBER:
                        return scsi_ioctl(sdp, cmd, p);
+               case SCSI_IOCTL_IDLE:
+                       return (jiffies - sdp->idle) / HZ + 1;
                default:
                        error = scsi_cmd_ioctl(filp, disk, cmd, p);
                        if (error != -ENOTTY)
diff -ur linux-2.6.12.2/include/scsi/scsi_device.h 
linux-2.6.12.2_scsi-idle/include/scsi/scsi_device.h
--- linux-2.6.12.2/include/scsi/scsi_device.h   2005-08-27 06:12:44.000000000 
+0200
+++ linux-2.6.12.2_scsi-idle/include/scsi/scsi_device.h 2005-08-27 
06:27:09.000000000 +0200
@@ -125,6 +125,7 @@
        atomic_t ioerr_cnt;
 
        int timeout;
+       unsigned long           idle;   /* scsi idle time in jiffers */
 
        struct device           sdev_gendev;
        struct class_device     sdev_classdev;
diff -ur linux-2.6.12.2/include/scsi/scsi_ioctl.h 
linux-2.6.12.2_scsi-idle/include/scsi/scsi_ioctl.h
--- linux-2.6.12.2/include/scsi/scsi_ioctl.h    2005-08-27 06:12:44.000000000 
+0200
+++ linux-2.6.12.2_scsi-idle/include/scsi/scsi_ioctl.h  2005-08-28 
17:32:17.000000000 +0200
@@ -7,6 +7,7 @@
 #define SCSI_IOCTL_SYNC 4                      /* Request synchronous 
parameters */
 #define SCSI_IOCTL_START_UNIT 5
 #define SCSI_IOCTL_STOP_UNIT 6
+#define SCSI_IOCTL_IDLE 4746                   /* get idle time in jiffies */
 /* The door lock/unlock constants are compatible with Sun constants for
    the cdrom */
 #define SCSI_IOCTL_DOORLOCK 0x5380             /* lock the eject mechanism */
============================================================



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to