aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2011-06-15 21:31:01 +0000
committerHauke Mehrtens <hauke@openwrt.org>2011-06-15 21:31:01 +0000
commita3c7fb6d3956d979f8fc3b770b73fe5c3cd0f741 (patch)
treeddcbfa29bdb1ce96cc700e7ed428a098053ecf8f /target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch
parent2e55411ec7cfe7a8198b9c2a2ba771600ec882a9 (diff)
downloadupstream-a3c7fb6d3956d979f8fc3b770b73fe5c3cd0f741.tar.gz
upstream-a3c7fb6d3956d979f8fc3b770b73fe5c3cd0f741.tar.bz2
upstream-a3c7fb6d3956d979f8fc3b770b73fe5c3cd0f741.zip
linux/generic: Add support for 3.0-rc3
Also make linux identify itself properly as 3.0, not 3.0.0. Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27191 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch')
-rw-r--r--target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch132
1 files changed, 132 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch b/target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch
new file mode 100644
index 0000000000..d4843ad6d5
--- /dev/null
+++ b/target/linux/generic/patches-3.0/512-jffs2_eofdetect.patch
@@ -0,0 +1,132 @@
+--- a/fs/jffs2/build.c
++++ b/fs/jffs2/build.c
+@@ -112,6 +112,17 @@ static int jffs2_build_filesystem(struct
+ dbg_fsbuild("scanned flash completely\n");
+ jffs2_dbg_dump_block_lists_nolock(c);
+
++ if (c->flags & (1 << 7)) {
++ printk("%s(): unlocking the mtd device... ", __func__);
++ if (c->mtd->unlock)
++ c->mtd->unlock(c->mtd, 0, c->mtd->size);
++ printk("done.\n");
++
++ printk("%s(): erasing all blocks after the end marker... ", __func__);
++ jffs2_erase_pending_blocks(c, -1);
++ printk("done.\n");
++ }
++
+ dbg_fsbuild("pass 1 starting\n");
+ c->flags |= JFFS2_SB_FLAG_BUILDING;
+ /* Now scan the directory tree, increasing nlink according to every dirent found. */
+--- a/fs/jffs2/scan.c
++++ b/fs/jffs2/scan.c
+@@ -72,7 +72,7 @@ static int file_dirty(struct jffs2_sb_in
+ return ret;
+ if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
+ return ret;
+- /* Turned wasted size into dirty, since we apparently
++ /* Turned wasted size into dirty, since we apparently
+ think it's recoverable now. */
+ jeb->dirty_size += jeb->wasted_size;
+ c->dirty_size += jeb->wasted_size;
+@@ -147,8 +147,11 @@ int jffs2_scan_medium(struct jffs2_sb_in
+ /* reset summary info for next eraseblock scan */
+ jffs2_sum_reset_collected(s);
+
+- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
+- buf_size, s);
++ if (c->flags & (1 << 7))
++ ret = BLK_STATE_ALLFF;
++ else
++ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
++ buf_size, s);
+
+ if (ret < 0)
+ goto out;
+@@ -405,7 +408,7 @@ static int jffs2_scan_xref_node(struct j
+ if (!ref)
+ return -ENOMEM;
+
+- /* BEFORE jffs2_build_xattr_subsystem() called,
++ /* BEFORE jffs2_build_xattr_subsystem() called,
+ * and AFTER xattr_ref is marked as a dead xref,
+ * ref->xid is used to store 32bit xid, xd is not used
+ * ref->ino is used to store 32bit inode-number, ic is not used
+@@ -478,7 +481,7 @@ static int jffs2_scan_eraseblock (struct
+ struct jffs2_sum_marker *sm;
+ void *sumptr = NULL;
+ uint32_t sumlen;
+-
++
+ if (!buf_size) {
+ /* XIP case. Just look, point at the summary if it's there */
+ sm = (void *)buf + c->sector_size - sizeof(*sm);
+@@ -494,9 +497,9 @@ static int jffs2_scan_eraseblock (struct
+ buf_len = sizeof(*sm);
+
+ /* Read as much as we want into the _end_ of the preallocated buffer */
+- err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
++ err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
+ jeb->offset + c->sector_size - buf_len,
+- buf_len);
++ buf_len);
+ if (err)
+ return err;
+
+@@ -515,9 +518,9 @@ static int jffs2_scan_eraseblock (struct
+ }
+ if (buf_len < sumlen) {
+ /* Need to read more so that the entire summary node is present */
+- err = jffs2_fill_scan_buf(c, sumptr,
++ err = jffs2_fill_scan_buf(c, sumptr,
+ jeb->offset + c->sector_size - sumlen,
+- sumlen - buf_len);
++ sumlen - buf_len);
+ if (err)
+ return err;
+ }
+@@ -530,7 +533,7 @@ static int jffs2_scan_eraseblock (struct
+
+ if (buf_size && sumlen > buf_size)
+ kfree(sumptr);
+- /* If it returns with a real error, bail.
++ /* If it returns with a real error, bail.
+ If it returns positive, that's a block classification
+ (i.e. BLK_STATE_xxx) so return that too.
+ If it returns zero, fall through to full scan. */
+@@ -551,6 +554,17 @@ static int jffs2_scan_eraseblock (struct
+ return err;
+ }
+
++ if ((buf[0] == 0xde) &&
++ (buf[1] == 0xad) &&
++ (buf[2] == 0xc0) &&
++ (buf[3] == 0xde)) {
++ /* end of filesystem. erase everything after this point */
++ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
++ c->flags |= (1 << 7);
++
++ return BLK_STATE_ALLFF;
++ }
++
+ /* We temporarily use 'ofs' as a pointer into the buffer/jeb */
+ ofs = 0;
+ max_ofs = EMPTY_SCAN_SIZE(c->sector_size);
+@@ -676,7 +690,7 @@ scan_more:
+ scan_end = buf_len;
+ goto more_empty;
+ }
+-
++
+ /* See how much more there is to read in this eraseblock... */
+ buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
+ if (!buf_len) {
+@@ -912,7 +926,7 @@ scan_more:
+
+ D1(printk(KERN_DEBUG "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n",
+ jeb->offset,jeb->free_size, jeb->dirty_size, jeb->unchecked_size, jeb->used_size, jeb->wasted_size));
+-
++
+ /* mark_node_obsolete can add to wasted !! */
+ if (jeb->wasted_size) {
+ jeb->dirty_size += jeb->wasted_size;