[POWERPC] Fix viodasd geometry calculations
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 29 May 2007 06:06:54 +0000 (16:06 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 10 Jul 2007 11:40:28 +0000 (21:40 +1000)
Commit a885c8c4316e1c1d2d2c8755da3f3d14f852528d that introduced the
getgeo block device method changed the fallback number of sectors and
introduced a bug into the fallback cylinder number calculation.

Thanks to Rusty Russell for noticing this.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
drivers/block/viodasd.c

index 68592c3360111ef47de71cb88858bfb25d5b8a31..dae39911a11dd37a93c7c0323423c0d78357a563 100644 (file)
@@ -252,10 +252,10 @@ static int viodasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
        struct gendisk *disk = bdev->bd_disk;
        struct viodasd_device *d = disk->private_data;
 
-       geo->sectors = d->sectors ? d->sectors : 0;
+       geo->sectors = d->sectors ? d->sectors : 32;
        geo->heads = d->tracks ? d->tracks  : 64;
        geo->cylinders = d->cylinders ? d->cylinders :
-               get_capacity(disk) / (geo->cylinders * geo->heads);
+               get_capacity(disk) / (geo->sectors * geo->heads);
 
        return 0;
 }