Giampaolo, On Wednesday 06 June 2007 07:14, Giampaolo Mancini wrote: > > There are some patches > > committed by David on the openwrt svn but apparently there > > are still a few problems.  I now have backward > > compatibility, since I can read the old nand/yaffs data but > > I am unable to update any data after a first write to the > > device. > > I'm also having the very same behavior on a RB153 with OpenWRT > trunk's YAFFS: i can't modify any file on the YAFFS filesystem > but moving the file to /tmp, editing there and then moving > back to YAFFS filesystem does the job. Try applying this patch to yaffs_mtdif1.c. There is a problem when compiled with the CONFIG_YAFFS_9BYTE_TAGS option -- the line that sets 'shouldbeFF' to all ones, clobbers the deleted status byte in pt1. This is surely going to mess-up file updates. This patch includes some other tweaks for (missing) stats and message formating that are in my working version which I diff'ed with http://users.actrix.co.nz/manningc/yaffs2-ian-20070523.tgz to generate the patch. It's the change for 'chunkDeleted' that you need. -Ian --- yaffs_mtdif1.c-20070523 2007-05-17 11:52:39.000000000 -0400 +++ yaffs_mtdif1.c 2007-06-06 12:45:03.000000000 -0400 @@ -102,6 +102,8 @@ compile_time_assertion(sizeof(yaffs_PackedTags1) == 12); compile_time_assertion(sizeof(yaffs_Tags) == 8); + dev->nPageWrites++; + yaffs_PackTags1(&pt1, etags); yaffs_CalcTagsECC((yaffs_Tags *)&pt1); @@ -178,6 +180,8 @@ int retval; int deleted; + dev->nPageReads++; + memset(&ops, 0, sizeof(ops)); ops.mode = MTD_OOB_AUTO; ops.len = (data) ? chunkBytes : 0; @@ -237,7 +241,7 @@ deleted = !pt1.deleted; pt1.deleted = 1; #else - (void) deleted; /* not used */ + deleted = (yaffs_CountBits(((__u8 *)&pt1)[8]) < 7); #endif /* Check the packed tags mini-ECC and correct if necessary/possible. @@ -250,7 +254,8 @@ case 1: /* recovered tags-ECC error */ dev->tagsEccFixed++; - eccres = YAFFS_ECC_RESULT_FIXED; + if (eccres == YAFFS_ECC_RESULT_NO_ERROR) + eccres = YAFFS_ECC_RESULT_FIXED; break; default: /* unrecovered tags-ECC error */ @@ -265,13 +270,8 @@ yaffs_UnpackTags1(etags, &pt1); etags->eccResult = eccres; - /* Set deleted state. - */ -#ifndef CONFIG_YAFFS_9BYTE_TAGS + /* Set deleted state */ etags->chunkDeleted = deleted; -#else - etags->chunkDeleted = (yaffs_CountBits(((__u8 *)&pt1)[8]) < 7); -#endif return YAFFS_OK; } @@ -306,7 +306,7 @@ if (oobavail < YTAG1_SIZE) { yaffs_trace(YAFFS_TRACE_ERROR, - "mtd device has only %d bytes for tags, need %d", + "mtd device has only %d bytes for tags, need %d\n", oobavail, YTAG1_SIZE); return YAFFS_FAIL; }