HDIO_GETGEO vs. BLKGETSIZE

From: David Woodhouse (dwmw2@infradead.org)
Date: Mon May 22 2000 - 07:06:17 EST


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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:21 EST