[mtd] possible bug in nandsim

Tanya Brokhman tlinder at codeaurora.org
Thu Nov 7 06:43:13 EST 2013


Hi

I've recently started working with the nand simulator. For my testing 
purposes I have to use it with a cache file. Bellow are the commands I run:

modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa 
third_id_byte=0x00 fourth_id_byte=0x15 cache_file=cache_file.txt
modprobe ubi mtd=0 fm_autoconvert=1

Unfortunately, when trying the above I noticed that the next time i load 
nandsim and ubi on top of it the fastmap data is not saved at 
cache_file.txt and the device comes up as clean. Meaning, the cache file 
feature of the nandsim isn't working properly.

So while debugging this I think I found the root cause:
unsigned long *pages_written from struct nandsim also needs saving. 
Otherwise while reading a page (at read_page()) we enter the following 
code flow:

if (!test_bit(ns->regs.row, ns->pages_written)) {
		memset(ns->buf.byte, 0xFF, num);
} else {

thus, ignoring the content of the cache file.

I've fixed this internally in my build by just saving the content of 
pages_written to a file on __exit and reading from that file on __init.

I was wondering if someone had done this in a more elegant way perhaps?

If not, I'll beautify my patch and share.

Thanks,
Tanya Brokhman
-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation



More information about the linux-mtd mailing list