MTD traces on operation with filesystem

Brian Norris computersforpeace at gmail.com
Sat Jul 5 15:35:02 PDT 2014


Hi Joaquim,

On Thu, Jul 03, 2014 at 02:04:39PM +0200, Joaquim Duran wrote:
> To print traces, we've changed the variable 'mtd_debug_verbose' to
> 0x7. With this configuration, we get traces when we access to the
> flash when using the /dev/mtdblockX' device file, like:
> 
> dd if=uImage of=/dev/mtdblock3 bs=131072
[...]
> but not if I do write operation using the file system:
> 
> dd if=/dev/urandom of=test.txt bs=1024 count=4096

What filesystem are you using? What is your 'mount' command?

My guess is that you are not *actually* utilizing mtdblock for your
filesystem, but are relying on legacy behavior by which /dev/mtdblockX
gets translated to the appropriate MTD (not a block device).

See the notes here:

  http://www.linux-mtd.infradead.org/faq/jffs2.html#L_mtdblock

And the comments in mount_mtd() (drivers/mtd/mtdsuper.c):

	/* try the old way - the hack where we allowed users to mount
	 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
	 */

If this is the case, then mtdblock.c's tracing will not help you.

You're probably have better luck either tracing the calls to your
mtd->write() function itself. e.g., if you're using NAND, you'll have to
modify nand_write() in drivers/mtd/nand/nand_base.c.

(NB: as of kernel v3.3, commit eda95cbf75193808f62948fb0142ba0901d8bee2,
it should be easier to trace this, since we introduced a mtd_write()
wrapper function.)

Hope that helps.

Brian



More information about the linux-mtd mailing list