X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=yaffs_mtdif1.c;h=c5a02c7bf0d1b45588705321c2bf825e464c156a;hb=b7513bb1b6b84d430d1f1af6ccf2cefe8c2c5ce0;hp=7493f9b2d62c18167e992d497314181b14189a46;hpb=2f1bf981f055716660bbd10cfdd391b69f074f5e;p=yaffs2.git diff --git a/yaffs_mtdif1.c b/yaffs_mtdif1.c index 7493f9b..c5a02c7 100644 --- a/yaffs_mtdif1.c +++ b/yaffs_mtdif1.c @@ -36,7 +36,7 @@ /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17)) -const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.2 2007-07-23 19:14:04 imcd Exp $"; +const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.4 2007-10-01 19:43:12 imcd Exp $"; #ifndef CONFIG_YAFFS_9BYTE_TAGS # define YTAG1_SIZE 8 @@ -327,6 +327,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, { struct mtd_info * mtd = dev->genericDevice; int chunkNo = blockNo * dev->nChunksPerBlock; + loff_t addr = (loff_t)chunkNo * dev->nDataBytesPerChunk; yaffs_ExtendedTags etags; int state = YAFFS_BLOCK_STATE_DEAD; int seqnum = 0; @@ -340,11 +341,16 @@ int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo, } retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags); + etags.blockBad = (mtd->block_isbad)(mtd, addr); if (etags.blockBad) { yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "block %d is marked bad", blockNo); state = YAFFS_BLOCK_STATE_DEAD; } + else if (etags.eccResult != YAFFS_ECC_RESULT_NO_ERROR) { + /* bad tags, need to look more closely */ + state = YAFFS_BLOCK_STATE_NEEDS_SCANNING; + } else if (etags.chunkUsed) { state = YAFFS_BLOCK_STATE_NEEDS_SCANNING; seqnum = etags.sequenceNumber;