mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Juergen Borleis <jbe@pengutronix.de>
Subject: [PATCH 2/2] fs: jffs2: ignore cleanup hints
Date: Tue, 16 Apr 2024 08:17:30 +0200	[thread overview]
Message-ID: <20240416061730.1335890-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240416061730.1335890-1-s.hauer@pengutronix.de>

From: Juergen Borleis <jbe@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@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@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




  reply	other threads:[~2024-04-16  6:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  6:17 [PATCH 1/2] fs: jffs2: remove NAND write support entirely Sascha Hauer
2024-04-16  6:17 ` Sascha Hauer [this message]
2024-04-17  6:22 ` Sascha Hauer

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=20240416061730.1335890-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@pengutronix.de \
    /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