[RFC/PATCH] flash_eraseall: extra care if NOR flash is not BIT_WRITEABLE

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Sun Apr 5 16:07:44 EDT 2009


* Artem Bityutskiy | 2009-03-27 07:55:32 [+0200]:

>> I'm sorry. That is actually my point. The layout of the cleanmarker
>> (which are used only by JFFS2) depends on a specific kernel switch in
>> case of NOR flash which is not BIT_WRITEABLE and userland can't know
>> that.
>> I've sent a patch to remove the -j option because the generated
>> cleanmaker *may* be wrong. Artem replied that he would like to see this
>> fixed.
>> So here is an attempt to fix this: black listed ubi & data flash but I
>> dunno how fix the NOR case where does not have BIT_WRITEABLE bit. A
>> commandline switch for those who know what they do?
>> Why don't rip out -j and let the kernel create clean marker if it
>> needs it?
>
>I looked into your patch closer, and there is no such dependency
>actually. Now it looks fine for me.

okay. what about this:
in jffs2_do_fill_super() we have:


| c->cleanmarker_size = sizeof(struct jffs2_unknown_node);
12 bytes.

| 
| /* NAND (or other bizarre) flash... do setup accordingly */
| ret = jffs2_flash_setup(c);
| if (ret)
|         return ret;

and jfffs_flash_setup() is:
|static int jffs2_flash_setup(struct jffs2_sb_info *c) {
|        int ret = 0;
|        
|        if (jffs2_cleanmarker_oob(c)) {
|                /* NAND flash... do setup accordingly */
|                ret = jffs2_nand_flash_setup(c);
|                if (ret)
|                        return ret;
|        }       
|
|        /* and Dataflash */
|        if (jffs2_dataflash(c)) {
|                ret = jffs2_dataflash_setup(c);
|                if (ret)
|                        return ret;
|        }
|
|        /* and Intel "Sibley" flash */
|        if (jffs2_nor_wbuf_flash(c)) {
and jffs2_nor_wbuf_flash() depends on CONFIG_JFFS2_FS_WRITEBUFFER.
Without it is 0 and with it is defined to
(c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE))

|                ret = jffs2_nor_wbuf_flash_setup(c);
and jffs2_nor_wbuf_flash_setup() changes the cleanmarker size via

         c->cleanmarker_size = max(16u, c->mtd->writesize);

and this is != 12 in every case.

|                if (ret)
|                        return ret;
|        }
|        
|        /* and an UBI volume */
|        if (jffs2_ubivol(c)) {
|                ret = jffs2_ubivol_setup(c);
|                if (ret)
|                        return ret;
|        }
|   
|        return ret;
|}

Do I overlook something or why is there no dependency on
CONFIG_JFFS2_FS_WRITEBUFFER on NOR flash which does not have the
MTD_BIT_WRITEABLE flag?

>
>I can apply them if there are not complaints. But how you have
>tested them? I would not want to break 'flash_eraseall' once again :-)
understand. Nope, I do not have such flash. I got a bug report against
clean marker on a data flash and that is why I started looking into
this.

>
>-- 
>Best regards,
>Artem Bityutskiy (Битюцкий Артём)
>

Sebastian



More information about the linux-mtd mailing list