[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231019073838.17586-3-mmkurbanov@salutedevices.com>
Date: Thu, 19 Oct 2023 10:38:38 +0300
From: Martin Kurbanov <mmkurbanov@...utedevices.com>
To: David Woodhouse <dwmw2@...radead.org>,
Richard Weinberger <richard@....at>,
Christian Brauner <brauner@...nel.org>,
Dave Chinner <dchinner@...hat.com>, Yu Zhe <yuzhe@...china.com>
CC: <linux-kernel@...r.kernel.org>, <linux-mtd@...ts.infradead.org>,
<kernel@...rdevices.ru>,
Martin Kurbanov <mmkurbanov@...utedevices.com>
Subject: [PATCH v1 2/2] jffs2: make cleanmarker support option
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.
Signed-off-by: Martin Kurbanov <mmkurbanov@...utedevices.com>
---
fs/jffs2/Kconfig | 10 ++++++++++
fs/jffs2/os-linux.h | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/fs/jffs2/Kconfig b/fs/jffs2/Kconfig
index 7c96bc107218..8a66941d1e93 100644
--- a/fs/jffs2/Kconfig
+++ b/fs/jffs2/Kconfig
@@ -29,6 +29,16 @@ config JFFS2_FS_DEBUG
If reporting bugs, please try to have available a full dump of the
messages at debug level 1 while the misbehaviour was occurring.
+config JFFS2_FS_NOCLEANMARKER
+ bool "Disable cleanmarkers JFFS2 feature"
+ depends on JFFS2_FS_WRITEBUFFER
+ depends on MTD_NAND || MTD_SPI_NAND
+ default n
+ help
+ Do not write 'CLEANMARKER' nodes to the beginning of each erase block.
+ This option can be useful on NAND flash where there is no free
+ space in the OOB area or the entire OOB area is protected by ECC.
+
config JFFS2_FS_WRITEBUFFER
bool "JFFS2 write-buffering support"
depends on JFFS2_FS
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index c604f639a00f..ea42964d8118 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -109,7 +109,9 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
#define jffs2_can_mark_obsolete(c) (c->mtd->flags & (MTD_BIT_WRITEABLE))
#endif
-#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH)
+#define jffs2_cleanmarker_oob(c) \
+ (!IS_ENABLED(CONFIG_JFFS2_FS_NOCLEANMARKER) && \
+ ((c)->mtd->type == MTD_NANDFLASH))
#define jffs2_wbuf_dirty(c) (!!(c)->wbuf_len)
--
2.40.0
Powered by blists - more mailing lists