Charles, Following is a patch to check the oobavail to make sure that the OOB contains enough space to hold the tag, and if not, bail. If OOB is large enough to hold the tag, but not large enough to hold the tag w/ECC, then enable no-tags-ecc and emit a message. I need this change in my world since the NAND I'm using (MT29C4G48MAZAPAKQ5) with internal-to-NAND 4-bit ECC only has 16 bytes of OOB space available, but those bytes in the OOB are ECC'd as part of the page data so I still have ECC for the tag... Index: yaffs_vfs_multi.c =================================================================== --- yaffs_vfs.c (revision 27049) +++ yaffs_vfs.c (revision 27050) @@ -172,6 +172,7 @@ #include "yaffs_trace.h" #include "yaffs_guts.h" #include "yaffs_attribs.h" +#include "yaffs_packedtags2.h" #include "yaffs_linux.h" @@ -2616,6 +2617,7 @@ struct yaffs_dev *dev = 0; char devname_buf[BDEVNAME_SIZE + 1]; struct mtd_info *mtd; + struct nand_ecclayout *ecc; int err; char *data_str = (char *)data; struct yaffs_linux_context *context = NULL; @@ -2852,6 +2854,24 @@ if (options.tags_ecc_overridden) param->no_tags_ecc = !options.tags_ecc_on; + /* Check the OOB availble size; if too little to hold the tag + * the abort. If too little to hold the tag w/ecc, then disable + * tags ECC. */ + ecc = mtd->ecclayout; + if (ecc && (ecc->oobavail < sizeof(struct yaffs_packed_tags2_tags_only))) { + printk(KERN_ERR "yaffs: oobavail(%u) not enough to hold tag!\n", + ecc->oobavail); + return NULL; + } + + if (ecc && !param->no_tags_ecc + && (ecc->oobavail < sizeof(struct yaffs_packed_tags2))) { + printk(KERN_INFO + "yaffs: oobavail(%u) <= %u; forcing \"tags-ecc-off\"\n", + ecc->oobavail, sizeof(struct yaffs_packed_tags2)); + param->no_tags_ecc = 1; + } + param->empty_lost_n_found = 1; param->refresh_period = 500; param->disable_summary = options.disable_summary; -- Peter Barada peter.barada@logicpd.com