[PATCH] hd.c needs max_sectors set

From: Paul Gortmaker (p_gortmaker@yahoo.com)
Date: Fri Feb 16 2001 - 05:37:23 EST


[Yet more fixes from the OCD - Obsolete Cruft Department ]

Couldn't figure out why my el-lame-o testbox was generating random I/O
errors on large writes. I first suspected another booger cut loose in
the disk and generated the typical storm of errors since it has some
hundred or so bad blocks already... :)

I've supplied a similar fix for drivers/block/xd.c (untested, but
compiles & is straightforward). I'm tempted to just mark xd.c
with CONFIG_OBSOLETE anyway. Anybody really see using this in 2.4.x,
even if just as a boot device for a closet box?

Paul.

--- drivers/ide/hd.c~ Thu Feb 15 03:33:12 2001
+++ drivers/ide/hd.c Thu Feb 15 06:55:28 2001
@@ -22,6 +22,9 @@
  * This is now a lightweight ST-506 driver. (Paul Gortmaker)
  *
  * Modified 1995 Russell King for ARM processor.
+ *
+ * Bugfix: max_sectors must be <= 255 or the wheels tend to come
+ * off in a hurry once you queue things up - Paul G. 02/2001
  */
   
 /*
@@ -106,6 +109,7 @@
 static int hd_sizes[MAX_HD<<6];
 static int hd_blocksizes[MAX_HD<<6];
 static int hd_hardsectsizes[MAX_HD<<6];
+static int hd_maxsect[MAX_HD<<6];
 
 static struct timer_list device_timer;
 
@@ -732,9 +736,11 @@
         for(drive=0; drive < (MAX_HD << 6); drive++) {
                 hd_blocksizes[drive] = 1024;
                 hd_hardsectsizes[drive] = 512;
+ hd_maxsect[drive]=255;
         }
         blksize_size[MAJOR_NR] = hd_blocksizes;
         hardsect_size[MAJOR_NR] = hd_hardsectsizes;
+ max_sectors[MAJOR_NR] = hd_maxsect;
 
 #ifdef __i386__
         if (!NR_HD) {
--- drivers/block/xd.c~ Mon Nov 20 04:16:39 2000
+++ drivers/block/xd.c Fri Feb 16 05:22:03 2001
@@ -28,6 +28,9 @@
  * Recovered DMA access. Abridged messages. Added support for DTC5051CX,
  * WD1002-27X & XEBEC controllers. Driver uses now some jumper settings.
  * Extended ioctl() support.
+ *
+ * Bugfix: 15/02/01, Paul G. - inform queue layer of tiny xd_maxsect.
+ *
  */
 
 #include <linux/module.h>
@@ -118,6 +121,7 @@
 static struct hd_struct xd_struct[XD_MAXDRIVES << 6];
 static int xd_sizes[XD_MAXDRIVES << 6], xd_access[XD_MAXDRIVES];
 static int xd_blocksizes[XD_MAXDRIVES << 6];
+static int xd_maxsect[XD_MAXDRIVES << 6];
 
 extern struct block_device_operations xd_fops;
 
@@ -241,6 +245,10 @@
                 else
                         printk("xd: unable to get IRQ%d\n",xd_irq);
         }
+
+ /* xd_maxsectors depends on controller - so set after detection */
+ for(i=0; i<(XD_MAXDRIVES << 6); i++) xd_maxsect[i] = xd_maxsectors;
+ max_sectors[MAJOR_NR] = xd_maxsect;
 
         for (i = 0; i < xd_drives; i++) {
                 xd_valid[i] = 1;

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 23 2001 - 21:00:12 EST