BLKRRPART bug + fix in mtd_blkdevs-24.c in mtd-snapshot-20040914.tar.bz2

Frantisek Rysanek Frantisek.Rysanek at post.cz
Thu Sep 16 08:36:08 EDT 2004


Dear Mr. Woodhouse,

I've found a bug in the functions serving the BLKRRPART 
ioctl() in the 2.4 branch of MTD blkdevs. See the attached 
patch, I believe it contains a fix.

My DiskOnChip was detected just fine, but when I flushed the 
original partition and issued a BLKRRPART, the device would 
report half its original size. If I did it again, it would
report a quarter size... etc.

Seems like the driver would re-init device size to a size 
denominated in 1k blocks, rather than sectors (512B).

Attached are two simple proggies that I'm using in my 
partitioning scripts.


Otherwise the driver seems to work just fine.
Actually I also had to insert 

#ifndef CONFIG_MTD_CFI_GEOMETRY
#define CONFIG_MTD_MAP_BANK_WIDTH_1
#endif

at the beginning of $KERNEL/include/linux/mtd/map.h

to make it compile. Seems like a dependency mismatch between 
drivers/mtd/chips/Config.in and the headers/code. I don't have 
a CFI MTD, but I do need drivers/mtd/chips/chipreg.o even for 
my DiskOnChip (now a generic NFTL device).


Thanks for the great job you're doing on MTD :-)

Frank Rysanek

-------------- next part --------------
--- mtd_blkdevs-24.old.c	2004-09-16 12:51:08.000000000 +0200
+++ mtd_blkdevs-24.c	2004-09-16 12:54:38.000000000 +0200
@@ -315,7 +315,7 @@
 	}
 
 	grok_partitions(gd, minor, 1 << tr->part_bits, 
-			tr->blkcore_priv->sizes[minor]);
+			dev->size);
 	up(&mtd_table_mutex);
 
 	return 0;
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  reset_disk.c
     Date:  16 Sep 2004, 13:23
     Size:  989 bytes.
     Type:  Program-source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reset_disk.c
Type: application/octet-stream
Size: 988 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20040916/a8c94be3/attachment.obj 
-------------- next part --------------
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  geom.c
     Date:  16 Sep 2004, 13:23
     Size:  1569 bytes.
     Type:  Program-source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geom.c
Type: application/octet-stream
Size: 1569 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20040916/a8c94be3/attachment-0001.obj 


More information about the linux-mtd mailing list