mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Orgad Shaneh <orgads@gmail.com>
To: dwmw2@infradead.org, richard@nod.at
Cc: miquel.raynal@bootlin.com, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] jffs2: reschedule between the data CRC checks of an inode
Date: Wed, 18 Nov 2026 21:40:45 +0000	[thread overview]
Message-ID: <20261118214045.107562-2-orgads@gmail.com> (raw)
In-Reply-To: <20261118214045.107562-1-orgads@gmail.com>

The first read of an inode checks the data CRC of each of its unchecked
nodes, all in one call. On an Octeon board with an 8-bit NOR, a
46.6 MB file takes 13.8 s of kernel time there. Without kernel
preemption, nothing else ran on that CPU in the meantime: an RT
watchdog thread missed its deadline and the board rebooted. With
this, the lookup takes as long, but the watchdog, the per-CPU
workqueue and the other tasks of that CPU keep running.

jffs2_get_inode_nodes() already reschedules per node while it reads
the headers; do the same before each data check.

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
---
 fs/jffs2/readinode.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 18a47b432..bfee9e57f 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -39,6 +39,13 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
 
 	BUG_ON(tn->csize == 0);
 
+	/*
+	 * A large inode has thousands of data nodes to check on its first
+	 * read, and a slow flash takes seconds over them; give the CPU
+	 * away between nodes.
+	 */
+	cond_resched();
+
 	/* Calculate how many bytes were already checked */
 	ofs = ref_offset(ref) + sizeof(struct jffs2_raw_inode);
 	len = tn->csize;
-- 
2.53.0


      reply	other threads:[~2026-11-18 21:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 21:40 [PATCH 1/2] jffs2: check the data CRC of a node in RAM, not through point() Orgad Shaneh
2026-11-18 21:40 ` Orgad Shaneh [this message]

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=20261118214045.107562-2-orgads@gmail.com \
    --to=orgads@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    /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®