[RFC][PATCH] making jffs2 more realtime friendly when scanning a partly empty eraseblock

Nielsen David Marqvar David.Nielsen at frequentis.com
Tue May 6 12:23:41 EDT 2008


Hello,

I've had problems with jitter in a RTP stream occurring during mount of a
jffs2 fs.
With the code below, the jitter are significantly decreased.

The problem occurs when scanning an erase block with empty space in it. This
scan may take long depending on the size of the empty space within the erase
block and the speed of the flash. On my system scanning an almost empty (but
NOT completely empty!) erase block can take 80-100 ms (worst case).

I have added the code below to call cond_resched() for each 2 KiB scanned
(while the first check will be done before 2 KiB the code is simple and
fast).

Please take a look at the code below - comments are much appreciated.


Patch attached.
(How do I proceed to suggest this committed to the jffs2 source?)

Best regards,
David Marqvar Nielsen

-----
jffs2_scan_eraseblock(), line 653 in scan.c:

			D1(printk(KERN_DEBUG "Found empty flash at 0x%08x\n",
ofs));
		more_empty:
			inbuf_ofs = ofs - buf_ofs;
			while (inbuf_ofs < buf_len) {
				if (*(uint32_t *)(&buf[inbuf_ofs]) !=
0xffffffff) {
					printk(KERN_WARNING "Empty flash at
0x%08x ends at 0x%08x\n",
					       empty_start, ofs);
					if ((err = jffs2_scan_dirty_space(c,
jeb, ofs-empty_start)))
						return err;
					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;
			}
			/* Ran off end. */
			D1(printk(KERN_DEBUG "Empty flash to end of buffer at
0x%08x\n", ofs));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: scan_eraseblock_empty_rt.patch
Type: application/octet-stream
Size: 387 bytes
Desc: scan_eraseblock_empty_rt.patch
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20080506/c496406c/attachment.obj 


More information about the linux-mtd mailing list