[JFFS2] Reschedule in loops
authorArtem Bityutskiy <dedekind@infradead.org>
Thu, 28 Dec 2006 10:01:41 +0000 (12:01 +0200)
committerArtem Bityutskiy <dedekind@infradead.org>
Wed, 10 Jan 2007 12:01:00 +0000 (14:01 +0200)
Make JFFS2 nicer and teach it to call cond_resched() in loops
which may be quite large.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
fs/jffs2/scan.c
fs/jffs2/summary.c

index a167e1c5d0243611427a36493917e7009d87861b..3af746eaff0ec124168e0baffa247de09253e68c 100644 (file)
@@ -139,6 +139,8 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
        for (i=0; i<c->nr_blocks; i++) {
                struct jffs2_eraseblock *jeb = &c->blocks[i];
 
+               cond_resched();
+
                /* reset summary info for next eraseblock scan */
                jffs2_sum_reset_collected(s);
 
index c4f7e4703c0a32a0b8b43dd5903d184ad61e7cf1..25265965bdc1f67254dc51463510e19af07ec7aa 100644 (file)
@@ -396,6 +396,8 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
        for (i=0; i<je32_to_cpu(summary->sum_num); i++) {
                dbg_summary("processing summary index %d\n", i);
 
+               cond_resched();
+
                /* Make sure there's a spare ref for dirty space */
                err = jffs2_prealloc_raw_node_refs(c, jeb, 2);
                if (err)