[Yaffs] Make YAFFS2 work, patch1

Sergey Kubushyn ksi at koi8.net
Wed Oct 12 18:12:14 BST 2005


This is a quick hack probably good for foreseable future. I don't think a
revolution for large page devices is on the horizon, we will be using that
nand_oob_64 autoplacement scheme for quite a long time.

The proper way is to consult mtd_info->nand_oobinfo->oobavail and handle
YAFFS tags placement ourselves, in that same mtdif2.c. Autoplacement is not
rocket science, there is nothing divine in it. As a matter of fact it's as
simple as a shovel and proper handling of oobavail part of the entire oob
area is trivial and easier to implement than to write a "Hello, world"
program.

BTW, it is NOT a very good idea to write mtd->oobsize (i.e. 64) bytes of
data out of yaffs_PackedTags2 structure...

Here is the patch:

=== Cut ===
diff -urN linux-2.6.12.orig/fs/yaffs2/yaffs_mtdif2.c linux-2.6.12/fs/yaffs2/yaffs_mtdif2.c
--- linux-2.6.12.orig/fs/yaffs2/yaffs_mtdif2.c	2005-10-11 15:25:07.000000000 -0700
+++ linux-2.6.12/fs/yaffs2/yaffs_mtdif2.c	2005-10-11 15:35:05.000000000 -0700
@@ -66,7 +66,7 @@
 				       data);
 		if (tags)
 			retval =
-			    mtd->write_oob(mtd, addr, mtd->oobsize, &dummy,
+			    mtd->write_oob(mtd, addr + 2, sizeof(pt), &dummy,
 					   (__u8 *) & pt);

 	}
@@ -116,7 +116,7 @@
 					  dev->spareBuffer);
 	}

-	memcpy(&pt, dev->spareBuffer, sizeof(pt));
+	memcpy(&pt, &dev->spareBuffer[2], sizeof(pt));

 	if (tags)
 		yaffs_UnpackTags2(tags, &pt);
=== Cut ===

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************




More information about the yaffs mailing list