[PATCH 2/2] fs: jffs2: ignore cleanup hints

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 15 23:17:30 PDT 2024


From: Juergen Borleis <jbe at pengutronix.de>

Without any kind of write support cleanup hints make no sense and cannot
fixed inside the bootloader. Thus, ignore them entirely.

Signed-off-by: Juergen Borleis <jbe at pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/jffs2/os-linux.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 424acbdc4d..9c1c05eb6c 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -74,9 +74,17 @@ struct jffs2_file {
 
 #define SECTOR_ADDR(x) ( (((unsigned long)(x) / c->sector_size) * c->sector_size) )
 
+/**
+ * Read data from memory and ignore any hints about bitflips in case of NAND
+ * memory (because we cannot repair them).
+ */
 static inline int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *retlen, u_char *buf)
 {
-	return mtd_read((c)->mtd, ofs, len, retlen, buf);
+	int rc = mtd_read((c)->mtd, ofs, len, retlen, buf);
+	if (rc == -EUCLEAN)
+		return 0; // we are read-only, we cannot repair anything.
+
+	return rc;
 }
 
 /* support run-time speed-up while scanning NAND flashs */
-- 
2.39.2




More information about the barebox mailing list