Hi Daniel,
uncomment the define of this two labels in the makefile:
CONFIG_YAFFS_DISABLE_CHUNK_ERASED_CHECK
CONFIG_YAFFS_DISABLE_WRITE_VERIFY
In this way you avoid to re-read every chunk before write (to control if it's blank) and to re-read after a succesfull write.
I've also made a little modification of the yaffs_WriteNewChunkToNAND, to completely avoid chunks read after write (the original code avoids yaffs_VerifyCompare only).
Check the following code against cvs one.
static int yaffs_WriteNewChunkToNAND(struct yaffs_DeviceStruct *dev, const __u8 *data, yaffs_Spare *spare,int useReserve)
{
int chunk;
int writeOk = 1;
int attempts = 0;
do{
chunk = yaffs_AllocateChunk(dev,useReserve);
if(chunk >= 0)
{
// First check this chunk is erased...
#ifndef CONFIG_YAFFS_DISABLE_CHUNK_ERASED_CHECK
writeOk = yaffs_CheckChunkErased(dev,chunk);
#endif
if(!writeOk)
{
T(YAFFS_TRACE_ERROR,(TSTR("**>> yaffs chunk %d was not erased" TENDSTR),chunk));
}
else
{
writeOk = yaffs_WriteChunkToNAND(dev,chunk,data,spare);
}
attempts++;
#ifndef CONFIG_YAFFS_DISABLE_WRITE_VERIFY
if(writeOk)
{
unsigned char rbData[YAFFS_BYTES_PER_CHUNK];
yaffs_Spare rbSpare;
// Readback & verify
// If verify fails, then delete this chunk and try again
// To verify we compare everything except the block and
// page status bytes.
// NB We check a raw read without ECC correction applied
yaffs_ReadChunkFromNAND(dev,chunk,rbData,&rbSpare,0);
if(!yaffs_VerifyCompare(data,rbData,spare,&rbSpare))
{
// Didn't verify
T(YAFFS_TRACE_ERROR,(TSTR("**>> yaffs write verify failed on chunk %d" TENDSTR), chunk));
writeOk = 0;
}
}
#endif
if(writeOk)
{
// Copy the data into the write buffer.
// NB We do this at the end to prevent duplicates in the case of a write error.
//Todo
yaffs_HandleWriteChunkOk(dev,chunk,data,spare);
}
else
{
yaffs_HandleWriteChunkError(dev,chunk);
}
}
} while(chunk >= 0 && ! writeOk);
if(attempts > 1)
{
T(YAFFS_TRACE_ERROR,(TSTR("**>> yaffs write required %d attempts" TENDSTR),attempts));
dev->nRetriedWrites+= (attempts - 1);
}
return chunk;
}
To reduce writes I think you must wait (or aid ;) for Yaffs2, which will use a zero page rewrites to spare area and will have generally better performance over Yaffs.
Look at
www.aleph1.co.uk/yaffs/yaffs2.html
Regards
Adamo
> -----Original Message-----
> From: yaffs-admin@stoneboat.aleph1.co.uk
> [mailto:yaffs-admin@stoneboat.aleph1.co.uk]On Behalf Of Daniel
> Gustafsson
> Sent: lunedì 11 ottobre 2004 14.47
> To: yaffs@stoneboat.aleph1.co.uk
> Subject: [Yaffs] Optimizing the number of reads and writes to flash
>
>
>
>
> I am using yaffs/direct and I want to reduce the reads and
> writes towards
> the flash to an absolute minimum. I do not want any
> verifications of flash
> etc. I don not want to use ECC.
>
> I would greatly appreatiate any tips regarding the above
> issue but also how
> to reduce the footprint in RAM and size.
>
> Further more I am interested in some documetation what
> happens (reads/writes
> to flash) when performing some simple fs operations like
> read/write/open
> etc.
>
>
> I hope someone have the answers I am looking for,
>
> Best Regards
> Daniel Gustavsson
>
>
> _______________________________________________
> yaffs mailing list
> yaffs@stoneboat.aleph1.co.uk
> http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
>