mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Kurbanov <mmkurbanov@salutedevices.com>
To: Richard Weinberger <richard@nod.at>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Christian Brauner <brauner@kernel.org>,
	Dave Chinner <dchinner@redhat.com>, Yu Zhe <yuzhe@nfschina.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	kernel <kernel@sberdevices.ru>
Subject: Re: [PATCH v1 2/2] jffs2: make cleanmarker support option
Date: Tue, 24 Oct 2023 16:29:57 +0300	[thread overview]
Message-ID: <b6b5b413-0fbe-4ce2-9d44-451b16555eb3@salutedevices.com> (raw)
In-Reply-To: <406915015.32119.1698083084288.JavaMail.zimbra@nod.at>



On 23.10.2023 20:44, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "Martin Kurbanov" <mmkurbanov@salutedevices.com>
>> If you disable the cleanmarker, the found clean block (filled with 0xff)
>> will be erased again (see fs/jffs2/scan.c#L162).
>> In my opinion, it is better to perform the block erasure again than to
>> not work with such a nand flash at all.
> 
> Doesn't this case many re-erases at each mount time?

You are right. David proposed the good solution.

> BTW: I tried your patch in nandsim, jffs2 was unhappy.
> [   56.147361] jffs2: notice: (440) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
> [   56.200438] nand: nand_do_write_ops: attempt to write non page aligned data
> [   56.201090] jffs2: Write clean marker to block at 0x001f8000 failed: -22
> 
> Do you have an idea?

According to this code from the function jffs2_mark_erased_block():

```
if (jffs2_cleanmarker_oob(c) || c->cleanmarker_size == 0) {

    if (jffs2_cleanmarker_oob(c)) {
        if (jffs2_write_nand_cleanmarker(c, jeb))
            goto filebad;
    }
} else {

    struct kvec vecs[1];
    struct jffs2_unknown_node marker = {
        .magic = cpu_to_je16(JFFS2_MAGIC_BITMASK),
        .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
        .totlen = cpu_to_je32(c->cleanmarker_size)
    };
```

the "if" branch should be executed because "cleanmarker_size" is set to
0 for NAND flash:

```
int jffs2_nand_flash_setup(struct jffs2_sb_info *c)
{
    if (!c->mtd->oobsize)
        return 0;

    /* Cleanmarker is out-of-band, so inline size zero */
    c->cleanmarker_size = 0;
```

In your case, the "else" branch was executed. I assume that "oobsize" is
equal to 0. In this scenario, JFFS2 will not mount without
applying my patch.

-- 
Best Regards,
Martin Kurbanov

  reply	other threads:[~2023-10-24 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  7:38 [PATCH v1 0/2] " Martin Kurbanov
2023-10-19  7:38 ` [PATCH v1 1/2] jffs2: introduce jffs2_nandflash() Martin Kurbanov
2023-10-19  7:38 ` [PATCH v1 2/2] jffs2: make cleanmarker support option Martin Kurbanov
2023-10-19  8:12   ` Richard Weinberger
2023-10-23 14:54     ` Martin Kurbanov
2023-10-23 17:44       ` Richard Weinberger
2023-10-24 13:29         ` Martin Kurbanov [this message]
2023-10-23 17:55       ` David Woodhouse
2023-10-25 14:53         ` Martin Kurbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6b5b413-0fbe-4ce2-9d44-451b16555eb3@salutedevices.com \
    --to=mmkurbanov@salutedevices.com \
    --cc=brauner@kernel.org \
    --cc=dchinner@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel@sberdevices.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=yuzhe@nfschina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®