changeset 191:e77533ba330a

Fix bad-block status during query. Mtd read does not indicate bad-block status (reported by list subscriber "thisway.diy").
author imcd <imcd>
date Mon, 01 Oct 2007 19:40:33 +0000
parents 0dfc0420d47f
children 64c0f22e5164
files yaffs_mtdif1.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.3 2007-10-01 19:40:33 imcd Exp $";
 
 #ifndef CONFIG_YAFFS_9BYTE_TAGS
 # define YTAG1_SIZE 8
@@ -327,6 +327,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
 {
 	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,6 +341,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
 	}
 
 	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);