mtd/drivers/mtd mtd_blkdevs.c,1.17,1.18 mtd_blkdevs-24.c,1.12,1.13

David Woodhouse dwmw2 at infradead.org
Mon Sep 8 07:37:26 EDT 2003


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv12992

Modified Files:
	mtd_blkdevs.c mtd_blkdevs-24.c 
Log Message:
block size fixes

Index: mtd_blkdevs.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- mtd_blkdevs.c	9 Jul 2003 09:00:49 -0000	1.17
+++ mtd_blkdevs.c	8 Sep 2003 11:37:23 -0000	1.18
@@ -295,7 +295,10 @@
 	snprintf(gd->devfs_name, sizeof(gd->devfs_name),
 		 "%s/%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
 
-	set_capacity(gd, new->size);
+	/* 2.5 has capacity in units of 512 bytes while still
+	   having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
+	set_capacity(gd, (new->size * new->blksize) >> 9);
+
 	gd->private_data = new;
 	new->blkcore_priv = gd;
 	gd->queue = &tr->blkcore_priv->rq;

Index: mtd_blkdevs-24.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtd_blkdevs-24.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- mtd_blkdevs-24.c	8 Jul 2003 08:16:49 -0000	1.12
+++ mtd_blkdevs-24.c	8 Sep 2003 11:37:24 -0000	1.13
@@ -465,7 +465,12 @@
 		tr->blkcore_priv->part_table[i].start_sect = 0;
 	}
 
-	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = new->size;
+	/* 2.4 kernel takes block device size in BLOCK_SIZE_BITS 
+	   (usually 10), rather than in units of its own blksize. */
+	tr->blkcore_priv->sizes[new->devnum << tr->part_bits] = 
+		(new->size * new->blksize) >> BLOCK_SIZE_BITS;
+
+	/* But this is still in device's sectors? $DEITY knows */
 	tr->blkcore_priv->part_table[new->devnum << tr->part_bits].nr_sects = new->size;
 
 	if (tr->part_bits) {




More information about the linux-mtd-cvs mailing list