allow bigger packets in the marvell switch (does not fix the mtu problems yet)
[openwrt-10.03/.git] / target / linux / generic-2.6 / patches-2.6.24 / 204-jffs2_eofdetect.patch
1 Index: linux-2.6.23-rc6/fs/jffs2/build.c
2 ===================================================================
3 --- linux-2.6.23-rc6.orig/fs/jffs2/build.c      2007-09-21 16:23:53.000000000 +0800
4 +++ linux-2.6.23-rc6/fs/jffs2/build.c   2007-09-21 16:24:05.000000000 +0800
5 @@ -105,6 +105,17 @@
6         dbg_fsbuild("scanned flash completely\n");
7         jffs2_dbg_dump_block_lists_nolock(c);
8  
9 +       if (c->flags & (1 << 7)) {
10 +               printk("%s(): unlocking the mtd device... ", __func__);
11 +               if (c->mtd->unlock)
12 +                       c->mtd->unlock(c->mtd, 0, c->mtd->size);
13 +               printk("done.\n");
14 +               
15 +               printk("%s(): erasing all blocks after the end marker... ", __func__);
16 +               jffs2_erase_pending_blocks(c, -1);
17 +               printk("done.\n");
18 +       }
19 +
20         dbg_fsbuild("pass 1 starting\n");
21         c->flags |= JFFS2_SB_FLAG_BUILDING;
22         /* Now scan the directory tree, increasing nlink according to every dirent found. */
23 Index: linux-2.6.23-rc6/fs/jffs2/scan.c
24 ===================================================================
25 --- linux-2.6.23-rc6.orig/fs/jffs2/scan.c       2007-09-21 16:23:52.000000000 +0800
26 +++ linux-2.6.23-rc6/fs/jffs2/scan.c    2007-09-21 16:24:05.000000000 +0800
27 @@ -142,9 +142,12 @@
28  
29                 /* reset summary info for next eraseblock scan */
30                 jffs2_sum_reset_collected(s);
31 -
32 -               ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
33 -                                               buf_size, s);
34 +               
35 +               if (c->flags & (1 << 7))
36 +                       ret = BLK_STATE_ALLFF;
37 +               else
38 +                       ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
39 +                                                       buf_size, s);
40  
41                 if (ret < 0)
42                         goto out;
43 @@ -545,6 +548,17 @@
44                         return err;
45         }
46  
47 +       if ((buf[0] == 0xde) &&
48 +               (buf[1] == 0xad) &&
49 +               (buf[2] == 0xc0) &&
50 +               (buf[3] == 0xde)) {
51 +               /* end of filesystem. erase everything after this point */
52 +               printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
53 +               c->flags |= (1 << 7);
54 +
55 +               return BLK_STATE_ALLFF;
56 +       }
57 +       
58         /* We temporarily use 'ofs' as a pointer into the buffer/jeb */
59         ofs = 0;
60