linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pdcraid and weird IDE geometry
@ 2003-07-17  2:26 Walt H
  2003-07-17  8:49 ` Arjan van de Ven
  2003-07-17 12:19 ` David Zaffiro
  0 siblings, 2 replies; 12+ messages in thread
From: Walt H @ 2003-07-17  2:26 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]

Hello all,

I ran into a weird problem when I received my latest replacement
DeskStar drive from Hitachi. It was the same size as the GXP60 it
replaced, but had much different geometry. I use these two 40GB drives
with a Promise FastTrak 20276 controller as a raid0 array. The
controller finds the drives and sets up the raid no problem. The pdcraid
module from vanilla 2.4.21 only found 1 drive however, and it was the
original existing drive. Testing with Promise's partial opensource
driver shows that the array does indeed work correctly with their driver.

A few printk's later, I determined the problem. The geometry of the two
drives are as follows:

cat /proc/ide/hde/geometry   (Old Drive)
physical     79780/16/63
logical      79780/16/63

cat /proc/ide/hdg/geometry (New Drive)
physical     5005/255/63
logical      5005/255/63


The calc_pdcblock_offset function calculates lba by taking the capacity
of the drive and dividing it by (head * sector), multiplying the result
times (head * sector) and subtracting the sector (SPT) count.
Unfortunately, with the strange geometry reported by the new drive,
using INTs to store these values will fail. The capacity of each drive
is exactly the same of 80418240 as reported by procfs and
ideinfo->capacity. In order to return the superblock offset correctly I
had to use non-integer vars. I've tested the resulting module and it now
correctly locates both drives, read and writes as expected and is
compatible with the binary FastTrak.o module. I'm not much of a coder,
so if this could be done more efficiently than my attached patch, please
let me know. Please CC any replies. Thanks,

-Walt Holman



[-- Attachment #2: pdcraid.patch --]
[-- Type: text/plain, Size: 693 bytes --]

--- /usr/src/temp/linux-2.4.21/drivers/ide/raid/pdcraid.c       2003-06-13 07:51:34.000000000 -0700
+++ pdcraid.c   2003-07-16 19:03:15.000000000 -0700
@@ -361,8 +361,14 @@
        if (ideinfo->sect==0)
                return 0;
-       lba = (ideinfo->capacity / (ideinfo->head*ideinfo->sect));
-       lba = lba * (ideinfo->head*ideinfo->sect);
-       lba = lba - ideinfo->sect;
+
+       float lbatemp = 0;
+       float head = ideinfo->head;
+       float sect = ideinfo->sect;
+       float capacity = ideinfo->capacity;
+       lbatemp = (capacity / (head*sect));
+       lbatemp = lbatemp * (head*sect);
+       lbatemp = lbatemp - sect;

+       lba = lbatemp;
        return lba;
 }

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [PATCH] pdcraid and weird IDE geometry
@ 2003-07-18 14:51 Walt H
  0 siblings, 0 replies; 12+ messages in thread
From: Walt H @ 2003-07-18 14:51 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]

Just to finish this thread. In case anyone else has similar problems of
only detecting 1 drive of their array and you suspect strange geometry
is at play, here's the simple patch I used in the end which WFM :)

-Walt



[-- Attachment #2: pdcraid.patch --]
[-- Type: text/plain, Size: 490 bytes --]

--- /usr/src/temp/linux-2.4.21/drivers/ide/raid/pdcraid.c	2003-06-13 07:51:34.000000000 -0700
+++ pdcraid.c	2003-07-18 06:54:25.000000000 -0700
@@ -361,7 +361,8 @@
 	if (ideinfo->sect==0)
 		return 0;
-	lba = (ideinfo->capacity / (ideinfo->head*ideinfo->sect));
+/*	lba = (ideinfo->capacity / (ideinfo->head*ideinfo->sect));
 	lba = lba * (ideinfo->head*ideinfo->sect);
-	lba = lba - ideinfo->sect;
+	lba = lba - ideinfo->sect; */
+	lba = ideinfo->capacity - ideinfo->sect;
 
 	return lba;

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-07-18 15:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-17  2:26 [PATCH] pdcraid and weird IDE geometry Walt H
2003-07-17  8:49 ` Arjan van de Ven
2003-07-17 14:37   ` Walt H
2003-07-17 14:58     ` Alan Cox
2003-07-17 15:34       ` Jeff Garzik
2003-07-17 16:03         ` Andries Brouwer
2003-07-17 15:34       ` Andries Brouwer
2003-07-18  2:33         ` Walt H
2003-07-18  8:58           ` Andries Brouwer
2003-07-18 13:56             ` Walt H
2003-07-17 12:19 ` David Zaffiro
2003-07-18 14:51 Walt H

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).