Messages in this thread Patch in this message |  | | Date | Thu, 07 Sep 2000 00:42:42 +0200 | From | Luca Montecchiani <> | Subject | [PATCH?] Extended PTBL partition check for 2.4 |
| |
Hi, few ours ago I discover that my kernel 2.4.0-test8pre5 was unable to correctly identify the geometry of my second ide HD (*), this is very bad and fdisk come out with a lot of warnings, see:
Disk /dev/hdc: 16 heads, 63 sectors, 6296 cylinders Units = cylinders of 1008 * 512 bytes
Device Boot Start End Blocks Id System /dev/hdc1 1 2032 1024127+ 83 Linux Partition 1 does not end on cylinder boundary: phys=(253, 127, 63) should be (253, 15, 63) /dev/hdc2 2033 2296 133056 82 Linux swap Partition 2 does not end on cylinder boundary: phys=(286, 127, 63) should be (286, 15, 63) /dev/hdc4 2297 6296 2016000 5 Extended Partition 4 does not end on cylinder boundary: phys=(786, 127, 63) should be (786, 15, 63) /dev/hdc5 2297 2704 205631+ 83 Linux /dev/hdc6 2705 6296 1810367+ 83 Linux
This is how the kernel see the world:
hda: 26520480 sectors (13578 MB) w/1966KiB Cache, CHS=1650/255/63, (U)DMA hdc: 6346368 sectors (3249 MB) w/96KiB Cache, CHS=6296/16/63, DMA Partition check: hda: hda1 hda2 hda3 hda4 < hda5 hda6 > hdc: hdc1 hdc2 hdc4 < hdc5 hdc6 >
Booting with 2.2.17 everything work fine, that kernel correctly identify the [PTBL] nature of my hdc and apply all the necessary conversion see:
hda: IBM-DJNA-371350, 12949MB w/1966kB Cache, CHS=1650/255/63 hdc: IBM-DAQA-33240, 3098MB w/96kB Cache, CHS=6296/16/63 Partition check: hda: hda1 hda2 hda3 hda4 < hda5 hda6 > hdc: [PTBL] [787/128/63] hdc1 hdc2 hdc4 < hdc5 hdc6 >
fdisk is a lot happy now:
Disk /dev/hdc: 128 heads, 63 sectors, 787 cylinders Units = cylinders of 8064 * 512 bytes
Device Boot Start End Blocks Id System /dev/hdc1 1 254 1024127+ 83 Linux /dev/hdc2 255 287 133056 82 Linux swap /dev/hdc4 288 787 2016000 5 Extended /dev/hdc5 288 338 205631+ 83 Linux /dev/hdc6 339 787 1810367+ 83 Linux
Ok, to the code.
2.2.17/drivers/block/genhd.c :
for (i = 0; i < 4; i++) { struct partition *q = &p[i]; if (NR_SECTS(q) && (q->sector & 63) == 1 && (q->end_sector & 63) == 63) { unsigned int heads = q->end_head + 1; if (heads == 32 || heads == 64 || heads == 128 || heads == 240 || heads == 255) { (void) ide_xlate_1024(dev, heads, " [PTBL]"); break; } }
2.4.0-pre8/fs/partitions/msdos.c :
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; } }
Debugging the code show that 2.4.0 always exit at the first valid partition found, discarding the remaining ones and to early to identify the PTBL nature of my hdc disk.
this is what 2.4.0-pre8 does:
i=0 NR=2048255 q->sector=2 q->end_sector=63 q->end_head=127 break
this is what 2.2.17 does:
i=0 NR=2048255 q->sector=2 q->end_sector=63 q->end_head=127 i=1 NR=266112 q->sector=1 q->end_sector=127 q->end_head=127 PTBL! break
Follow the patch that works for me (tm):
--- msdos.c.ORI Wed Jul 19 08:29:16 2000 +++ msdos.c Wed Sep 6 23:46:29 2000 @@ -398,9 +398,10 @@ struct partition *q = &p[i]; if (NR_SECTS(q)) { if ((q->sector & 63) == 1 && - (q->end_sector & 63) == 63) + (q->end_sector & 63) == 63) { heads = q->end_head + 1; - break; + break; + } } } if (SYS_IND(p) == EZD_PARTITION) {
Seem that 2.4.0test8 follow the PTBL definition described in the Large-Disk-HOWTO, only primary partition, 2.2.17 instead extend the check all over the four partition.
(*) The hdc disk was autopartitioned by sfdisk over a 2.2.17 kernel
comments ? luca -- ------------------------------------------------------------------ E-mail......: Luca Montecchiani <m.luca@iname.com> W.W.W.......: http://i.am/m.luca - http://luca.myip.org Speakfreely.: sflwl -hlwl.fourmilab.ch luca@ I.C.Q.......: 17655604 -----------------------=(Linux since 1995)=----------------------- Non esiste vento favorevole per il marinaio che non sa dove andare Seneca - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |