3 @@ -105,6 +105,17 @@ static int jffs2_build_filesystem(struct
4 dbg_fsbuild("scanned flash completely\n");
5 jffs2_dbg_dump_block_lists_nolock(c);
7 + if (c->flags & (1 << 7)) {
8 + printk("%s(): unlocking the mtd device... ", __func__);
10 + c->mtd->unlock(c->mtd, 0, c->mtd->size);
13 + printk("%s(): erasing all blocks after the end marker... ", __func__);
14 + jffs2_erase_pending_blocks(c, -1);
18 dbg_fsbuild("pass 1 starting\n");
19 c->flags |= JFFS2_SB_FLAG_BUILDING;
20 /* Now scan the directory tree, increasing nlink according to every dirent found. */
23 @@ -142,9 +142,12 @@ int jffs2_scan_medium(struct jffs2_sb_in
25 /* reset summary info for next eraseblock scan */
26 jffs2_sum_reset_collected(s);
28 - ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
31 + if (c->flags & (1 << 7))
32 + ret = BLK_STATE_ALLFF;
34 + ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
39 @@ -545,6 +548,17 @@ static int jffs2_scan_eraseblock (struct
43 + if ((buf[0] == 0xde) &&
47 + /* end of filesystem. erase everything after this point */
48 + printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
49 + c->flags |= (1 << 7);
51 + return BLK_STATE_ALLFF;
54 /* We temporarily use 'ofs' as a pointer into the buffer/jeb */