[PATCH][JFFS2] Reschedule during scan of partly empty eraseblock

Nielsen David Marqvar David.Nielsen at frequentis.com
Thu May 29 05:29:43 EDT 2008


This patch adds rescheduling to the loop that scans an empty area of an
eraseblock.

Rationale:
When scanning the an empty area of an eraseblock no scheduling occurs. But
this scan may take significantly long to complete depending on the size of 
the empty space within the eraseblock and the speed of the flash (on my
system
it could theoretically be up to 100 ms).
The patch will add a call to cond_resched() for each 2 KiB scanned (while the
first check may be done before 2 KiB the code is simple and fast).

The patch has been tested and running on our systems for a month now.


Signed-off-by: David Marqvar Nielsen <david.nielsen at frequentis.com>
---
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 1d437de..044a4a1 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -654,6 +654,10 @@ scan_more:
                                        goto scan_more;
                                }

+                               /* check for resched - searching an
eraseblock may take several ms */
+                               if ( (ofs & 0x7ff /* for each 2KiB */) == 0)
+                                       cond_resched();
+
                                inbuf_ofs+=4;
                                ofs += 4;
                        }




More information about the linux-mtd mailing list