HDIO_GETGEO vs. BLKGETSIZE
David Woodhouse
dwmw2 at infradead.org
Mon May 22 08:06:17 EDT 2000
Is it permitted for a driver to returns CHS values for HDIO_GETGEO which,
when multiplied together, don't match the value returned by BLKGETSIZE?
i.e. Is the code in the second 'if' statement below actually necessary?
thisNFTL->cylinders = 1024;
thisNFTL->heads = 16;
temp = thisNFTL->cylinders * thisNFTL->heads;
thisNFTL->sectors = thisNFTL->nr_sects / temp;
if (thisNFTL->nr_sects % temp) {
thisNFTL->sectors++;
temp = thisNFTL->cylinders * thisNFTL->sectors;
thisNFTL->heads = thisNFTL->nr_sects / temp;
if (thisNFTL->nr_sects & temp) {
thisNFTL->heads++;
temp = thisNFTL->heads * thisNFTL->sectors;
thisNFTL->cylinders = thisNFTL->nr_sects / temp;
}
}
/* Do we really need to do this.... ? */
if (thisNFTL->nr_sects != thisNFTL->heads * thisNFTL->cylinders *
thisNFTL->sectors) {
printk("NFTL capacity reduced for geometry reasons from %lx to %x sectors\n", thisNFTL->nr_sects,
thisNFTL->heads * thisNFTL->cylinders * thisNFTL->sectors);
thisNFTL->nr_sects = thisNFTL->heads * thisNFTL->cylinders * thisNFTL->sectors;
}
--
dwmw2
To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org
More information about the linux-mtd
mailing list