projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add newlines to a couple of trace/diagnostic messages.
[yaffs2.git]
/
yaffs_mtdif1.c
diff --git
a/yaffs_mtdif1.c
b/yaffs_mtdif1.c
index 4fd3ea3a51d12a88e05101dee963555858ecfd1c..ad2932054659d1a9fd1b7fd4900097a642074ddd 100644
(file)
--- 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))
/* 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.
1 2007-07-18 19:40:38 charles
Exp $";
+const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.
5 2007-10-29 14:59:57 imcd
Exp $";
#ifndef CONFIG_YAFFS_9BYTE_TAGS
# define YTAG1_SIZE 8
#ifndef CONFIG_YAFFS_9BYTE_TAGS
# define YTAG1_SIZE 8
@@
-102,6
+102,8
@@
int nandmtd1_WriteChunkWithTagsToNAND(yaffs_Device *dev,
compile_time_assertion(sizeof(yaffs_PackedTags1) == 12);
compile_time_assertion(sizeof(yaffs_Tags) == 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);
yaffs_PackTags1(&pt1, etags);
yaffs_CalcTagsECC((yaffs_Tags *)&pt1);
@@
-178,6
+180,8
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
int retval;
int deleted;
int retval;
int deleted;
+ dev->nPageReads++;
+
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunkBytes : 0;
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
ops.len = (data) ? chunkBytes : 0;
@@
-237,7
+241,7
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
deleted = !pt1.deleted;
pt1.deleted = 1;
#else
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.
#endif
/* Check the packed tags mini-ECC and correct if necessary/possible.
@@
-250,7
+254,8
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
case 1:
/* recovered tags-ECC error */
dev->tagsEccFixed++;
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 */
break;
default:
/* unrecovered tags-ECC error */
@@
-265,13
+270,8
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
yaffs_UnpackTags1(etags, &pt1);
etags->eccResult = eccres;
yaffs_UnpackTags1(etags, &pt1);
etags->eccResult = eccres;
- /* Set deleted state.
- */
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
+ /* Set deleted state */
etags->chunkDeleted = deleted;
etags->chunkDeleted = deleted;
-#else
- etags->chunkDeleted = (yaffs_CountBits(((__u8 *)&pt1)[8]) < 7);
-#endif
return YAFFS_OK;
}
return YAFFS_OK;
}
@@
-288,7
+288,7
@@
int nandmtd1_MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockNo)
int blocksize = dev->nChunksPerBlock * dev->nDataBytesPerChunk;
int retval;
int blocksize = dev->nChunksPerBlock * dev->nDataBytesPerChunk;
int retval;
- yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "marking block %d bad", blockNo);
+ yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "marking block %d bad
\n
", blockNo);
retval = mtd->block_markbad(mtd, (loff_t)blocksize * blockNo);
return (retval) ? YAFFS_FAIL : YAFFS_OK;
retval = mtd->block_markbad(mtd, (loff_t)blocksize * blockNo);
return (retval) ? YAFFS_FAIL : YAFFS_OK;
@@
-306,7
+306,7
@@
static int nandmtd1_TestPrerequists(struct mtd_info * mtd)
if (oobavail < YTAG1_SIZE) {
yaffs_trace(YAFFS_TRACE_ERROR,
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;
}
oobavail, YTAG1_SIZE);
return YAFFS_FAIL;
}
@@
-327,6
+327,7
@@
int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo,
{
struct mtd_info * mtd = dev->genericDevice;
int chunkNo = blockNo * dev->nChunksPerBlock;
{
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;
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);
}
retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
+ etags.blockBad = (mtd->block_isbad)(mtd, addr);
if (etags.blockBad) {
yaffs_trace(YAFFS_TRACE_BAD_BLOCKS,
if (etags.blockBad) {
yaffs_trace(YAFFS_TRACE_BAD_BLOCKS,
- "block %d is marked bad", blockNo);
+ "block %d is marked bad
\n
", blockNo);
state = YAFFS_BLOCK_STATE_DEAD;
}
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;
else if (etags.chunkUsed) {
state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
seqnum = etags.sequenceNumber;