[PATCH 2/2] jffs2: reschedule between the data CRC checks of an inode

From: Orgad Shaneh

Date: Wed Nov 18 2026 - 16:41:01 EST


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@xxxxxxxxx>
---
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