RomFS MTD and NAND Flash with ECC (EUCLEAN).
Bill Pringlemeir
bpringle at sympatico.ca
Mon Sep 19 16:19:11 EDT 2011
On 19 Sep 2011, dedekind1 at gmail.com wrote:
On Fri, 2011-09-16 at 16:46 -0400, Bill Pringlemeir wrote:
>> #ifdef CONFIG_ROMFS_ON_MTD
>> -#define ROMFS_MTD_READ(sb, ...) ((sb)->s_mtd->read((sb)->s_mtd, ##__VA_ARGS__))
>> -
>> +#define ROMFS_MTD_READ(sb, ...) \
>> + ({ int res; \
>> + res = ((sb)->s_mtd->read((sb)->s_mtd, ##__VA_ARGS__)) == -EUCLEAN ? \
>> + 0 : res; })
> I do not think this is the most elegant way to handle this, but yes,
> EUCLEAN is used nowadays to report about bit-flips, which are actually
> not an error, more like an info that this eraseblock needs some
> attention.
Good. Neither do I. Sometimes code is better at describing a problem.
> I am not sure MTD is the right subsystem for this patch, could you try
> to send it to fs-devel / Al Viro instead?
I kind of thought it was not a good patch. I will try to rework it.
Now, I am sure of 'EUCLEAN's meaning. I also observe that my romfs
works fine with a NAND flash if the BLOCK device is used.
Currently the romfs code is making a decision based on...
int romfs_dev_read(struct super_block *sb, unsigned long pos,
...
if (sb->s_mtd)
return romfs_mtd_read(sb, pos, buf, buflen);
The NAND flash will not map directly to a CPU memory space like a NOR
flash. I *think* the main benefit of this MTD is for the non-MMU in
directly mapping files? What is the benefit of using the MTD versus the
block device for NAND flash? [I think that is not a fs-devel
question...].
Can we look at sb->s_mtd->type for 'MTD_NANDFLASH' (etc) and bind a vptr
in romfs_get_sb(), so that 'romfs_dev_*()' would actually be function
pointers. Then NAND and NOR mtd's could both have a RomFS on the same
system. Err that only makes sense if I can get an answer to the last
question.
Also, it is not the place of RomFs to be writing flash. However, if
there is an EUCLEAN return code, is it worth a printk?
tia,
Bill Pringlemeir.
--
It is reasoning and faith that bind truth . - Rod Ryker...
--
A mind that is stretched to a new idea never returns to its original
dimension - Anonymous
More information about the linux-mtd
mailing list