public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Adam Wozniak <adam.wozniak@comdev.cc>
Cc: linux-mtd@lists.infradead.org
Subject: Re: debugging strategies for jffs2
Date: Fri, 01 Feb 2002 23:30:03 +0000	[thread overview]
Message-ID: <4997.1012606203@redhat.com> (raw)
In-Reply-To: <3C5B2246.2ABBCEFD@comdev.cc>

adam.wozniak@comdev.cc said:
>  Here's the workaround I came up with: in scan.c:

Yeah - with a couple more elsewhere too...

Index: nodelist.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.c,v
retrieving revision 1.36
diff -u -r1.36 nodelist.c
--- nodelist.c	2002/01/09 16:52:59	1.36
+++ nodelist.c	2002/02/01 23:29:35
@@ -240,7 +240,12 @@
 			}
 			tn->version = node.i.version;
 			tn->fn->ofs = node.i.offset;
-			tn->fn->size = node.i.dsize;
+			/* There was a bug where we wrote hole nodes out with
+			   csize/dsize swapped. Deal with it */
+			if (node.i.compr == JFFS2_COMPR_ZERO && !node.i.dsize && node.i.csize)
+				tn->fn->size = node.i.csize;
+			else // normal case...
+				tn->fn->size = node.i.dsize;
 			tn->fn->raw = ref;
 			D1(printk(KERN_DEBUG "dnode @%08x: ver %u, offset %04x, dsize %04x\n", ref->flash_offset &~3, node.i.version, node.i.offset, node.i.dsize));
 			jffs2_add_tn_to_list(tn, &ret_tn);
Index: read.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/read.c,v
retrieving revision 1.19
diff -u -r1.19 read.c
--- read.c	2002/01/14 23:30:26	1.19
+++ read.c	2002/02/01 23:29:35
@@ -74,6 +74,12 @@
 		ret = -EIO;
 		goto out_ri;
 	}
+	/* There was a bug where we wrote hole nodes out with csize/dsize
+	   swapped. Deal with it */
+	if (ri->compr == JFFS2_COMPR_ZERO && !ri->dsize && ri->csize) {
+		ri->dsize = ri->csize;
+		ri->csize = 0;
+	}
 
 	D1(if(ofs + len > ri->dsize) {
 		printk(KERN_WARNING "jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n", len, ofs, ri->dsize);
Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.57
diff -u -r1.57 scan.c
--- scan.c	2002/01/09 13:25:58	1.57
+++ scan.c	2002/02/01 23:29:35
@@ -443,6 +443,12 @@
 		*ofs += 4;
 		return 0;
 	}
+	/* There was a bug where we wrote hole nodes out with csize/dsize
+	   swapped. Deal with it */
+	if (ri.compr == JFFS2_COMPR_ZERO && !ri.dsize && ri.csize) {
+		ri.dsize = ri.csize;
+		ri.csize = 0;
+	}
 
 	if (ri.csize) {
 		/* Check data CRC too */
@@ -473,7 +479,7 @@
 			       *ofs, ri.data_crc, crc);
 			DIRTY_SPACE(PAD(ri.totlen));
 			*ofs += PAD(ri.totlen);
-			return -0;
+			return 0;
 		}
 	}
 

--
dwmw2

  reply	other threads:[~2002-02-01 23:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-01 14:24 Fwd: Re: JFFS XConfig David Mackay
2002-02-01 15:11 ` David Woodhouse
2002-02-01 17:33   ` debugging strategies for jffs2 Adam Wozniak
2002-02-01 18:04     ` David Woodhouse
2002-02-01 18:34       ` Adam Wozniak
2002-02-01 19:38         ` David Woodhouse
2002-02-01 19:44         ` Adam Wozniak
2002-02-01 21:40           ` Adam Wozniak
2002-02-01 23:11             ` David Woodhouse
2002-02-01 23:18               ` Adam Wozniak
2002-02-01 23:30                 ` David Woodhouse [this message]
2002-02-01 23:41                   ` Adam Wozniak
2004-12-17  3:24           ` PATCH to help understanding Charles Manning
2004-12-20  6:59             ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4997.1012606203@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=adam.wozniak@comdev.cc \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox