[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JFFS




(Please don't send mail to the linux-mtd-cvs list; that's for CVS commit 
messages only. The MTD list is linux-mtd@xxxxxxx.


kadamsom@xxxxxxx.in said:
> i dont have any problem in creating 
> i am able to cp small files to jffs mount point /mnt and delete it
> but problem i faced is when  delete any  file i get message as  free
> memory size accounting screwed up 

Firstly, can you try the patch which Mike just gave me to verify writes in 
JFFS.

Index: fs/jffs/intrep.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs/intrep.c,v
retrieving revision 1.102
diff -u -r1.102 intrep.c
--- fs/jffs/intrep.c	2001/09/23 23:28:36	1.102
+++ fs/jffs/intrep.c	2001/10/09 06:56:39
@@ -192,6 +192,42 @@
 	return ret;
 }
 
+void
+flash_verify_write(struct mtd_info *mtd, loff_t to,
+		   const u_char *buf, size_t count)
+{
+	u_char *v_buf;
+	int retlen;
+	int i;
+	int first;
+
+	v_buf = (u_char *) kmalloc (count, GFP_KERNEL);
+	if (!v_buf) {
+		printk("flash_verify_write: could not allocate v_buf\n");
+		return;
+	}
+
+	memset(v_buf, 0xa5, count);
+
+	MTD_READ(mtd, to, count, &retlen, v_buf);
+	if (count != retlen) {
+		printk("flash_verify_write: read count did not match - ");
+		printk("count = 0x%x, retlen = 0x%x\n", (int)count, (int)retlen);
+		return;
+	}
+	first = 1;
+	for (i = 0; i < count; i++) {
+		if (buf[i] != v_buf[i]) {
+			if (first) {
+				printk("verifying buffer at 0x%x, count = 0x%x\n", 
+				       (u_int)to, (int) count);
+				first = 0;
+			}
+			printk("\t offset = 0x%8x: expected 0x%2x, got 0x%2x\n", 
+			       i, (int)buf[i], (int)v_buf[i]);
+		}
+	}
+}
 
 static int
 flash_safe_write(struct mtd_info *mtd, loff_t to,
@@ -207,6 +243,8 @@
 	if (retlen != count) {
 		printk("Didn't write all bytes in flash_safe_write(). Returned %d\n", res);
 	}
+	flash_verify_write(mtd, to, buf, count);
+
 	return res?res:retlen;
 }
 
@@ -239,6 +277,8 @@
 			if (i != iovec_cnt-1)
 				return -EIO;
 		}
+		flash_verify_write(mtd, to, vecs[i].iov_base, vecs[i].iov_len);
+
 		/* If res is non-zero, retlen_a is undefined, but we don't
 		   care because in that case it's not going to be 
 		   returned anyway.


--
dwmw2



To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com