Strange automatic GC threshold ?

Joakim Tjernlund joakim.tjernlund at
Mon Mar 19 12:16:49 EDT 2007

In jffs2_thread_should_wake() there is this test to
wake up GC thread:
	/* dirty_size contains blocks on erase_pending_list
	 * those blocks are counted in c->nr_erasing_blocks.
	 * If one block is actually erased, it is not longer counted as dirty_space
	 * but it is counted in c->nr_erasing_blocks, so we add it and subtract it
	 * with c->nr_erasing_blocks * c->sector_size again.
	 * Blocks on erasable_list are counted as dirty_size, but not in c->nr_erasing_blocks
	 * This helps us to force gc and pick eventually a clean block to spread the load.
	dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size;

	if (c->nr_free_blocks + c->nr_erasing_blocks < c->resv_blocks_gctrigger &&
			(dirty > c->nospc_dirty_size))

The && in the above if means that no matter how dirty the FS is, it wont
trigger GC until there is a very low count of free blocks as well(24 in my
case out of 1003). I wonder if that && should be a || instead?


More information about the linux-mtd mailing list