[Yaffs] questions about yaffs_WriteDataToFile

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: zheng shi
Date:  
To: YAFFS
Subject: [Yaffs] questions about yaffs_WriteDataToFile
1. When written bytes are appended to the end of file,
there's no need to read the correspoding chunks.
The overhead is unnecessary and was especially
large before yaffs_guts.c version 1.89.

2. In yaffs_ReadChunkDataFromObject, the condition
should be changed:

static int yaffs_ReadChunkDataFromObject(yaffs_Object *in, int chunkInInode,
                    __u8 *buffer)
{
    int chunkInNAND = yaffs_FindChunkInFile(in, chunkInInode, NULL);


-    if (chunkInNAND >= 0)
+   if (chunkInNAND > 0)
        return yaffs_ReadChunkWithTagsFromNAND(in->myDev, chunkInNAND,
                        buffer, NULL);
    else {
        T(YAFFS_TRACE_NANDACCESS,
          (TSTR("Chunk %d not found zero instead" TENDSTR),
           chunkInNAND));
        /* get sane (zero) data if you read a hole */
        memset(buffer, 0, in->myDev->nDataBytesPerChunk);
        return 0;
    }


--
Regards, Shizheng