mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Martin Kurbanov <mmkurbanov@salutedevices.com>,
	Richard Weinberger <richard@nod.at>
Cc: 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@sberdevices.ru
Subject: Re: [PATCH v1 2/2] jffs2: make cleanmarker support option
Date: Mon, 23 Oct 2023 18:55:57 +0100	[thread overview]
Message-ID: <cb1456a3fa874772a531c4885f0d204041ecf5bf.camel@infradead.org> (raw)
In-Reply-To: <3951ac21-a0a4-47b5-be94-edb0140c69a5@salutedevices.com>

[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]

On Mon, 2023-10-23 at 17:54 +0300, Martin Kurbanov wrote:
> Hello Richard,
> 
> On 19.10.2023 11:12, Richard Weinberger wrote:
> > > This patch support for disable cleanmarker option. This is useful on
> > > some NAND devices which entire OOB area is protected by ECC. Problem
> > > fires when JFFS2 driver writes cleanmarker to some page and later it
> > > tries to write to this page - write will be done successfully, but after
> > > that such page becomes unreadable due to invalid ECC codes. This occurs
> > > because the second write necessitates an update to ECC, but it is
> > > impossible to do it correctly without block erase.
> > Hmm, I miss an explanation why this change is correct and safe.
> > You explain why the OOB area can't be used, okay. But you need to
> > add more details on why you change is safe in terms of filesystem
> > consistency.
>  
> 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.

Erasing all unused blocks over and over again on every reboot/remount
is going to destroy your flash quite quickly, surely?

I think you need to come up with a way to log the clean blocks (or
erase requests) in the JFFS2 log itself.

Perhaps a 'block erase log' node type, which just contains a version#
and a list of blocks which are currently being erased. You write it out
before doing any erase operation. And then at *some* point after the
erase completes (it doesn't need to be immediate) you write out a new
one (which may be empty, or may list new blocks which are about to be
erased).

On mount, we just need to re-erase any blocks which are indicated as
being erased in the latest erase log node.

> > Beside of that, I don't think this should be kernel config option.
> > Why not a mount option?
> 
> Agreed

Why even a mount option? Shouldn't it be automatic, depending on the
type of flash chip?



[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

  parent reply	other threads:[~2023-10-23 17:56 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
2023-10-23 17:55       ` David Woodhouse [this message]
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=cb1456a3fa874772a531c4885f0d204041ecf5bf.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=brauner@kernel.org \
    --cc=dchinner@redhat.com \
    --cc=kernel@sberdevices.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mmkurbanov@salutedevices.com \
    --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®