Re: RFC: disk geometry via sysfs

From: Phillip Susi
Date: Thu Feb 16 2006 - 10:26:40 EST


linux-os (Dick Johnson) wrote:
I'm talking about the geometry of the disk. If the disk has 16 sectors
and 8 heads, then the maximum value allowed for any valid address is 16
in the sector field and 7 in the heads field. This influences the
translation to/from LBA. A sector with LBA of 1234 would have a CHS
address using this geometry of 9/5/3. If the disk reports a geometry of
x/8/16 but the bios is using a geometry of x/255/63, then when you pass
9/5/3 to int 13 it will fetch LBA 144902 which is clearly not going to
give you what you wanted.


Wrong! The disk gets an OFFSET! It doesn't care how that OFFSET
is obtained. That OFFSET is the sum of some variables. Some start
at 0 and some start at 1. The BIOS takes these PHONY things, without
checking to see if they "fit" in some pre-conceived notion of
"geometery" and sums them all up to make an OFFSET. The C/H/S
stuff started and ENDED with the ST-506 interface. PERIOD.


Please reread my explanation above. The bios has to compute the absolute offset based on the geometry and the values you pass it. It does so by multiplying the track number you pass by the number of sectors per track, multiplies the cylinder number by the number of sectors per track and the number of tracks, and adds those two values to the sector number you pass to arrive at the LBA to read. If it performs the CHS->LBA translation using a different geometry than you used to go from LBA->CHS, then it will get the wrong sector.


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