linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Walt H <waltabbyh@comcast.net>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] pdcraid and weird IDE geometry
Date: Wed, 16 Jul 2003 19:26:45 -0700	[thread overview]
Message-ID: <3F160965.7060403@comcast.net> (raw)

[-- 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;
 }

             reply	other threads:[~2003-07-17  2:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-17  2:26 Walt H [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F160965.7060403@comcast.net \
    --to=waltabbyh@comcast.net \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] pdcraid and weird IDE geometry' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).