Re: [Yaffs] Wrong data after unmount/mount

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
CC: Beat Morf
Subject: Re: [Yaffs] Wrong data after unmount/mount
Hi Beat

I will need to ask you a few questions to help me understand better.

On Monday 29 August 2005 21:19, Beat Morf wrote:
> Hi
>
> I have a small question concerning the YAFFS direct implementation and
> appending data on a file.
>
> I have a file called "file01". Now I use the procedure "yaffs_write(h,
> buffer, 600) to append data to the file until no more space is left (my
> flash supports 512Bytes/Chunk and I reduced the total YAFFS size to
> 1916928 Bytes):


So is that 117 blocks of 32 pages of 512 bytes?
How many reserve blocks?
How many short op caches?


> - Size of the file "file01": 1041408
> - Available size but not useable: 875008


How did you determine there was no more space?

Did you do something like:
while (yaffs_write(h,buffer,600) > 0)
{
}

How did you determine "available size but not usable"?
>
> If I change the size of the buffer to "yaffs_write(h, buffer, 1024), I
> get following result:
> - Size of the file "file01": 1904128
> - Available size but not useable: 12288
>
> What happens if I add packets with size of 600Bytes? Do YAFFS use 2
> chunks and in the second chunk 424 Bytes are lost (512 - (600-512) = 424)
> ?!


The difference between these is that the one will use the cache and the other
will not. The short op cache only works on data that is not page aligned, in
the following way

Let us examine what happens to a sequence of 600-byte writes, starting at
location zero:

write 600:
Chunk 1 (bytes 0..511) written to NAND bypassing cache.
Chunk 2 (bytes512..599) written to cache entry 1.
write 600
Chunk 2 (bytes 600..1023) appended to cache entry 1.
Chunk 3 (bytes 1024..1199) written to cache entry 2
write 600
Chunk 3 (bytes 1200..1535) appended to cache entry 2.
Chunk 4 (bytes 1536..1799) written to cache entry 3.
...

When the cache gets full or the file is flushed/closed it will force stuff to
be written from the cache to NAND.

Since the writes of 1024 are all page aligned, they are not placed in the
cache.

No data should be lost and no space should be wasted in this operation.

-- CHarles