2003-01-16 18:05:39

by Jim Houston

[permalink] [raw]
Subject: [patch] IDE OnTrack remap for 2.5.58


Hi Everyone,

I'm running a Seagate 80 GB disk in an old Pentium Pro dual processor.
I installed the current Redhat (phoebe) beta, and it works fine until
I try to boot a 2.5.58 kernel. It fails to mount the root disk because
the disk has been setup with OnTrack remaping. I didn't do anything
to ask for this remapping. Perhaps Seagate is shipping with this pre-
installed?

I went back and looked through the patches and found that the remapping
support was removed in patch-2.5.30. The comments in the mailing list
suggest that it belonged in user space. I have not found code/instructions
on how to do this. Since then, most of IDE code has been reverted to the
2.4 versions but not this bit.

The attached patch is just the bit of code which was removed in 2.5.30
with the obvious changes needed to make it work in a 2.5.58 kernel.
I have a dream of upgrading my test machine to something clean and modern
unpolluted by backwards compatible cruft. Until then, this bit of code
doesn't seem too bad.

Jim Houston - Concurrent Computer Corp.


--- linux-2.5.58.orig/fs/partitions/msdos.c Thu Jan 16 11:56:13 2003
+++ linux-2.5.58/fs/partitions/msdos.c Wed Jan 15 17:32:22 2003
@@ -385,6 +385,87 @@
{SOLARIS_X86_PARTITION, parse_solaris_x86},
{0, NULL},
};
+/*
+ * Look for various forms of IDE disk geometry translation
+ */
+static int handle_ide_mess(struct block_device *bdev)
+{
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
+ Sector sect;
+ unsigned char *data;
+ kdev_t dev = to_kdev_t(bdev->bd_dev);
+ unsigned int sig;
+ int heads = 0;
+ struct partition *p;
+ int i;
+#ifdef CONFIG_BLK_DEV_IDE_MODULE
+ if (!ide_xlate_1024)
+ return 1;
+#endif
+ /*
+ * The i386 partition handling programs very often
+ * make partitions end on cylinder boundaries.
+ * There is no need to do so, and Linux fdisk doesn't always
+ * do this, and Windows NT on Alpha doesn't do this either,
+ * but still, this helps to guess #heads.
+ */
+ data = read_dev_sector(bdev, 0, &sect);
+ if (!data)
+ return -1;
+ if (!msdos_magic_present(data + 510)) {
+ put_dev_sector(sect);
+ return 0;
+ }
+ sig = le16_to_cpu(*(unsigned short *)(data + 2));
+ p = (struct partition *) (data + 0x1be);
+ for (i = 0; i < 4; i++) {
+ struct partition *q = &p[i];
+ if (NR_SECTS(q)) {
+ if ((q->sector & 63) == 1 &&
+ (q->end_sector & 63) == 63)
+ heads = q->end_head + 1;
+ break;
+ }
+ }
+ if (SYS_IND(p) == EZD_PARTITION) {
+ /*
+ * Accesses to sector 0 must go to sector 1 instead.
+ */
+ if (ide_xlate_1024(bdev, -1, heads, " [EZD]"))
+ goto reread;
+ } else if (SYS_IND(p) == DM6_PARTITION) {
+
+ /*
+ * Everything on the disk is offset by 63 sectors,
+ * including a "new" MBR with its own partition table.
+ */
+ if (ide_xlate_1024(bdev, 1, heads, " [DM6:DDO]"))
+ goto reread;
+ } else if (sig <= 0x1ae &&
+ data[sig] == 0xAA && data[sig+1] == 0x55 &&
+ (data[sig+2] & 1)) {
+ /* DM6 signature in MBR, courtesy of OnTrack */
+ (void) ide_xlate_1024 (bdev, 0, heads, " [DM6:MBR]");
+ } else if (SYS_IND(p) == DM6_AUX1PARTITION ||
+ SYS_IND(p) == DM6_AUX3PARTITION) {
+ /*
+ * DM6 on other than the first (boot) drive
+ */
+ (void) ide_xlate_1024(bdev, 0, heads, " [DM6:AUX]");
+ } else {
+ (void) ide_xlate_1024(bdev, 2, heads, " [PTBL]");
+ }
+ put_dev_sector(sect);
+ return 1;
+
+reread:
+ put_dev_sector(sect);
+ /* Flush the cache */
+ invalidate_bdev(bdev, 1);
+ truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
+#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
+ return 1;
+}

int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
{
@@ -393,7 +474,11 @@
unsigned char *data;
struct partition *p;
int slot;
+ int err;

+ err = handle_ide_mess(bdev);
+ if (err <= 0)
+ return err;
data = read_dev_sector(bdev, 0, &sect);
if (!data)
return -1;
@@ -439,6 +524,21 @@
state->parts[slot].flags = 1;
}

+ /*
+ * Check for old-style Disk Manager partition table
+ */
+ if (msdos_magic_present(data + 0xfc)) {
+ p = (struct partition *) (0x1be + data);
+ for (slot = 4 ; slot < 16 ; slot++, state->next++) {
+ p--;
+ if (state->next == state->limit)
+ break;
+ if (!(START_SECT(p) && NR_SECTS(p)))
+ continue;
+ put_partition(state, state->next,
+ START_SECT(p), NR_SECTS(p));
+ }
+ }
printk("\n");

/* second pass - output for each on a separate line */
@@ -456,7 +556,7 @@
if (!subtypes[n].parse)
continue;
subtypes[n].parse(state, bdev, START_SECT(p)*sector_size,
- NR_SECTS(p)*sector_size, slot);
+ NR_SECTS(p)*sector_size, n);
}
put_dev_sector(sect);
return 1;


2003-01-16 18:22:37

by Andre Hedrick

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58


Jim,

The remapping mess was ripped out in 2.5.
I do not want it back.
Remove your overlay junk on the drive and use it normal mode.

Cheers,

On Thu, 16 Jan 2003, Jim Houston wrote:

>
> Hi Everyone,
>
> I'm running a Seagate 80 GB disk in an old Pentium Pro dual processor.
> I installed the current Redhat (phoebe) beta, and it works fine until
> I try to boot a 2.5.58 kernel. It fails to mount the root disk because
> the disk has been setup with OnTrack remaping. I didn't do anything
> to ask for this remapping. Perhaps Seagate is shipping with this pre-
> installed?
>
> I went back and looked through the patches and found that the remapping
> support was removed in patch-2.5.30. The comments in the mailing list
> suggest that it belonged in user space. I have not found code/instructions
> on how to do this. Since then, most of IDE code has been reverted to the
> 2.4 versions but not this bit.
>
> The attached patch is just the bit of code which was removed in 2.5.30
> with the obvious changes needed to make it work in a 2.5.58 kernel.
> I have a dream of upgrading my test machine to something clean and modern
> unpolluted by backwards compatible cruft. Until then, this bit of code
> doesn't seem too bad.
>
> Jim Houston - Concurrent Computer Corp.
>
>
> --- linux-2.5.58.orig/fs/partitions/msdos.c Thu Jan 16 11:56:13 2003
> +++ linux-2.5.58/fs/partitions/msdos.c Wed Jan 15 17:32:22 2003
> @@ -385,6 +385,87 @@
> {SOLARIS_X86_PARTITION, parse_solaris_x86},
> {0, NULL},
> };
> +/*
> + * Look for various forms of IDE disk geometry translation
> + */
> +static int handle_ide_mess(struct block_device *bdev)
> +{
> +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
> + Sector sect;
> + unsigned char *data;
> + kdev_t dev = to_kdev_t(bdev->bd_dev);
> + unsigned int sig;
> + int heads = 0;
> + struct partition *p;
> + int i;
> +#ifdef CONFIG_BLK_DEV_IDE_MODULE
> + if (!ide_xlate_1024)
> + return 1;
> +#endif
> + /*
> + * The i386 partition handling programs very often
> + * make partitions end on cylinder boundaries.
> + * There is no need to do so, and Linux fdisk doesn't always
> + * do this, and Windows NT on Alpha doesn't do this either,
> + * but still, this helps to guess #heads.
> + */
> + data = read_dev_sector(bdev, 0, &sect);
> + if (!data)
> + return -1;
> + if (!msdos_magic_present(data + 510)) {
> + put_dev_sector(sect);
> + return 0;
> + }
> + sig = le16_to_cpu(*(unsigned short *)(data + 2));
> + p = (struct partition *) (data + 0x1be);
> + for (i = 0; i < 4; i++) {
> + struct partition *q = &p[i];
> + if (NR_SECTS(q)) {
> + if ((q->sector & 63) == 1 &&
> + (q->end_sector & 63) == 63)
> + heads = q->end_head + 1;
> + break;
> + }
> + }
> + if (SYS_IND(p) == EZD_PARTITION) {
> + /*
> + * Accesses to sector 0 must go to sector 1 instead.
> + */
> + if (ide_xlate_1024(bdev, -1, heads, " [EZD]"))
> + goto reread;
> + } else if (SYS_IND(p) == DM6_PARTITION) {
> +
> + /*
> + * Everything on the disk is offset by 63 sectors,
> + * including a "new" MBR with its own partition table.
> + */
> + if (ide_xlate_1024(bdev, 1, heads, " [DM6:DDO]"))
> + goto reread;
> + } else if (sig <= 0x1ae &&
> + data[sig] == 0xAA && data[sig+1] == 0x55 &&
> + (data[sig+2] & 1)) {
> + /* DM6 signature in MBR, courtesy of OnTrack */
> + (void) ide_xlate_1024 (bdev, 0, heads, " [DM6:MBR]");
> + } else if (SYS_IND(p) == DM6_AUX1PARTITION ||
> + SYS_IND(p) == DM6_AUX3PARTITION) {
> + /*
> + * DM6 on other than the first (boot) drive
> + */
> + (void) ide_xlate_1024(bdev, 0, heads, " [DM6:AUX]");
> + } else {
> + (void) ide_xlate_1024(bdev, 2, heads, " [PTBL]");
> + }
> + put_dev_sector(sect);
> + return 1;
> +
> +reread:
> + put_dev_sector(sect);
> + /* Flush the cache */
> + invalidate_bdev(bdev, 1);
> + truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
> +#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
> + return 1;
> +}
>
> int msdos_partition(struct parsed_partitions *state, struct block_device *bdev)
> {
> @@ -393,7 +474,11 @@
> unsigned char *data;
> struct partition *p;
> int slot;
> + int err;
>
> + err = handle_ide_mess(bdev);
> + if (err <= 0)
> + return err;
> data = read_dev_sector(bdev, 0, &sect);
> if (!data)
> return -1;
> @@ -439,6 +524,21 @@
> state->parts[slot].flags = 1;
> }
>
> + /*
> + * Check for old-style Disk Manager partition table
> + */
> + if (msdos_magic_present(data + 0xfc)) {
> + p = (struct partition *) (0x1be + data);
> + for (slot = 4 ; slot < 16 ; slot++, state->next++) {
> + p--;
> + if (state->next == state->limit)
> + break;
> + if (!(START_SECT(p) && NR_SECTS(p)))
> + continue;
> + put_partition(state, state->next,
> + START_SECT(p), NR_SECTS(p));
> + }
> + }
> printk("\n");
>
> /* second pass - output for each on a separate line */
> @@ -456,7 +556,7 @@
> if (!subtypes[n].parse)
> continue;
> subtypes[n].parse(state, bdev, START_SECT(p)*sector_size,
> - NR_SECTS(p)*sector_size, slot);
> + NR_SECTS(p)*sector_size, n);
> }
> put_dev_sector(sect);
> return 1;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

Andre Hedrick
LAD Storage Consulting Group

2003-01-16 19:48:02

by Andries Brouwer

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Thu, Jan 16, 2003 at 01:14:37PM -0500, Jim Houston wrote:

> I'm running a Seagate 80 GB disk in an old Pentium Pro dual processor.
> I installed the current Redhat (phoebe) beta, and it works fine until
> I try to boot a 2.5.58 kernel. It fails to mount the root disk because
> the disk has been setup with OnTrack remaping. I didn't do anything
> to ask for this remapping. Perhaps Seagate is shipping with this pre-
> installed?
>
> I went back and looked through the patches and found that the remapping
> support was removed in patch-2.5.30. The comments in the mailing list
> suggest that it belonged in user space. I have not found code/instructions
> on how to do this. Since then, most of IDE code has been reverted to the
> 2.4 versions but not this bit.
>
> The attached patch is just the bit of code which was removed in 2.5.30
> with the obvious changes needed to make it work in a 2.5.58 kernel.
> I have a dream of upgrading my test machine to something clean and modern
> unpolluted by backwards compatible cruft. Until then, this bit of code
> doesn't seem too bad.

My point of view:
(i) We must not carry this geometry nonsense forward in all
eternity. It is superfluous today. Get rid of it.
(ii) So, the automatic remapping is killed.
Most likely, there will be some people that still have old machines where
this remapping is necessary. Then there are two possible responses:
(iia) Don't run the latest kernel on an old cruft setup. Or,
(iib) Use boot parameters.

So, I am waiting a little, but if there is sufficient demand
we must have boot parameters that ask for an OnTrack remapping.

Concerning your particular case, I expect that you'll find that
your remapping is entirely superfluous.

If you like low level fiddling, boot from a floppy, e.g. tomsrtbt,
adapt the partition table and reboot. Now all should be well,
both under old and under new kernels. No data loss.

If you don't know how to fiddle, boot from a floppy, wipe the MBR
using dd if=/dev/zero, and reinstall. All data is lost.

Many intermediate approaches are possible.
We can discuss details in case you are interested.

Andries
[email protected]

2003-01-16 22:31:32

by David Woodhouse

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58


[email protected] said:
> +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)

Don't ever do that. Modules can be built later and shouldn't affect the
static kernel unless it's _absolutely_ necessary. And were these weird
partitioning schemes specific to IDE anyway?

--
dwmw2


2003-01-17 14:34:09

by Bill Davidsen

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Thu, 16 Jan 2003, Jim Houston wrote:

> I'm running a Seagate 80 GB disk in an old Pentium Pro dual processor.
> I installed the current Redhat (phoebe) beta, and it works fine until
> I try to boot a 2.5.58 kernel. It fails to mount the root disk because
> the disk has been setup with OnTrack remaping. I didn't do anything
> to ask for this remapping. Perhaps Seagate is shipping with this pre-
> installed?

Interesting if they are, but probably too late to determine. In any case
you *might* be able to clean it up with the extended menu geometry stuff
in fdisk. You might be able to go into the BIOS and tell it to use LBA,
although you might also lose what's on the drive that way.

> I went back and looked through the patches and found that the remapping
> support was removed in patch-2.5.30. The comments in the mailing list
> suggest that it belonged in user space. I have not found code/instructions
> on how to do this. Since then, most of IDE code has been reverted to the
> 2.4 versions but not this bit.

I suspect that this will not go back in the mainline kernel, although the
"best done in user space" comment made by someone is a bit of a challenge
when you need it in place to get the system booted... Best avoid needing
it if you can.

I saved the patch, some of the local users might have ned of it.

--
bill davidsen <[email protected]>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

2003-01-21 06:59:36

by Alan

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Thu, 2003-01-16 at 18:14, Jim Houston wrote:
> I went back and looked through the patches and found that the remapping
> support was removed in patch-2.5.30. The comments in the mailing list
> suggest that it belonged in user space. I have not found code/instructions
> on how to do this. Since then, most of IDE code has been reverted to the
> 2.4 versions but not this bit.

This was done without the involvement of the IDE maintainers. Please direct
complaints to Andries Brouwer. Come 2.6 the vendors will all be merging
it back into their trees.

Alan

2003-01-21 10:59:06

by Andries E. Brouwer

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Thu, 2003-01-16 at 18:14, Jim Houston wrote:
> I went back and looked through the patches and found that the remapping
> support was removed in patch-2.5.30. The comments in the mailing list
> suggest that it belonged in user space.

[of course a shift cannot be done in user space]

> I have not found code/instructions on how to do this.
> Since then, most of IDE code has been reverted to the
> 2.4 versions but not this bit.

This was done without the involvement of the IDE maintainers.
Please direct complaints to Andries Brouwer. Come 2.6 the vendors
will all be merging it back into their trees.

Alan

Ha, Alan -

I think both Andre and Martin were happy, but maybe you mean nobody
asked you? Are you unhappy with this change? And if so, why?

Andries

2003-01-21 11:57:29

by Andre Hedrick

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Tue, 21 Jan 2003 [email protected] wrote:

> On Thu, 2003-01-16 at 18:14, Jim Houston wrote:
> > I went back and looked through the patches and found that the remapping
> > support was removed in patch-2.5.30. The comments in the mailing list
> > suggest that it belonged in user space.
>
> [of course a shift cannot be done in user space]
>
> > I have not found code/instructions on how to do this.
> > Since then, most of IDE code has been reverted to the
> > 2.4 versions but not this bit.
>
> This was done without the involvement of the IDE maintainers.
> Please direct complaints to Andries Brouwer. Come 2.6 the vendors
> will all be merging it back into their trees.
>
> Alan
>
> Ha, Alan -
>
> I think both Andre and Martin were happy, but maybe you mean nobody
> asked you? Are you unhappy with this change? And if so, why?

It is a DGD to me ... but there are lots of tracking teathers (sp) for
laptops coming out and since the bios people will not share the HPA and
freeze lock it. These folks are looking to use overlays to fake the
effects of HPA.

Cheers,


Andre Hedrick
LAD Storage Consulting Group

2003-01-21 22:53:52

by Alan

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Tue, 2003-01-21 at 11:08, [email protected] wrote:
> On Thu, 2003-01-16 at 18:14, Jim Houston wrote:
> > I went back and looked through the patches and found that the remapping
> > support was removed in patch-2.5.30. The comments in the mailing list
> > suggest that it belonged in user space.
>
> [of course a shift cannot be done in user space]

Maybe it can. One reason ide/raid/*.c isnt in 2.5 is that I hope we can
use the device mapper to remove the entire chunk of code for these. dm
may also be sufficient to do the block shift.

> I think both Andre and Martin were happy, but maybe you mean nobody
> asked you? Are you unhappy with this change? And if so, why?

By volume of mail I get about it. I hadn't realised just how common
DM was. I'd prefer to make device mapper do it though.

2003-01-22 01:25:52

by Andries E. Brouwer

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

>> Are you unhappy with this change? And if so, why?

> By volume of mail I get about it.
> I hadn't realised just how common DM was.

Any numbers?
I do coach someone in getting rid of DM or EZD
perhaps once or twice a month.

As far as I can see, it is rare that DM is needed.
What sometimes happens is that DM is preinstalled on a disk,
and users first become aware of it when there are problems.

Andries

2003-01-28 13:17:18

by Alan

[permalink] [raw]
Subject: Re: [patch] IDE OnTrack remap for 2.5.58

On Wed, 2003-01-22 at 01:34, [email protected] wrote:
> >> Are you unhappy with this change? And if so, why?
>
> > By volume of mail I get about it.
> > I hadn't realised just how common DM was.
>
> Any numbers?

Currently about one a week.