[octeon] resync kernel configuration
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.21 / 204-jffs2_eofdetect.patch
1 --- a/fs/jffs2/build.c
2 +++ b/fs/jffs2/build.c
3 @@ -107,6 +107,17 @@ static int jffs2_build_filesystem(struct
4 dbg_fsbuild("scanned flash completely\n");
5 jffs2_dbg_dump_block_lists_nolock(c);
6
7 + if (c->flags & (1 << 7)) {
8 + printk("%s(): unlocking the mtd device... ", __func__);
9 + if (c->mtd->unlock)
10 + c->mtd->unlock(c->mtd, 0, c->mtd->size);
11 + printk("done.\n");
12 +
13 + printk("%s(): erasing all blocks after the end marker... ", __func__);
14 + jffs2_erase_pending_blocks(c, -1);
15 + printk("done.\n");
16 + }
17 +
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. */
21 --- a/fs/jffs2/scan.c
22 +++ b/fs/jffs2/scan.c
23 @@ -143,9 +143,12 @@ int jffs2_scan_medium(struct jffs2_sb_in
24
25 /* reset summary info for next eraseblock scan */
26 jffs2_sum_reset_collected(s);
27 -
28 - ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
29 - buf_size, s);
30 +
31 + if (c->flags & (1 << 7))
32 + ret = BLK_STATE_ALLFF;
33 + else
34 + ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
35 + buf_size, s);
36
37 if (ret < 0)
38 goto out;
39 @@ -546,6 +549,17 @@ static int jffs2_scan_eraseblock (struct
40 return err;
41 }
42
43 + if ((buf[0] == 0xde) &&
44 + (buf[1] == 0xad) &&
45 + (buf[2] == 0xc0) &&
46 + (buf[3] == 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);
50 +
51 + return BLK_STATE_ALLFF;
52 + }
53 +
54 /* We temporarily use 'ofs' as a pointer into the buffer/jeb */
55 ofs = 0;
56
This page took 0.045976 seconds and 5 git commands to generate.