[Yaffs-archive] Re: [YAFFS] slow performance

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: Edward J. Lee
CC: yaffs
Subject: [Yaffs-archive] Re: [YAFFS] slow performance
On Wednesday 30 April 2003 00:22, Edward J. Lee wrote:
> Hi YAFFSers, been a while.
>
> No problems were found using YAFFS but now I'm suffering by extra-slow
> performance.
> My program formerly stored user configurations in HDDs, now we're
> storing it in
> NAND. As the saving part involves a great deal of fopen()s, fseek()s,
> fwrite()s, and etc.,
> It took a while (but not TOO much) storing it in HDDs. But on YAFFS, the
> time
> grew catastrophically, and it takes approx. 15 secs saving 62KB!
>
> Does anyone have any ideas that might help me out?


This is the sort of thing that will happen if your writes and reads cannot
use the caching effectively.

YAFFS works directly on the flash with no buffering between the file system
and the flash. There is, however, buffering in the form of the normal kernel
cache between YAFFS and the applicaion.
The caching is flushed out by any close or flush. On a close or flush, the
file's ObjectHeader will also be updated, costing another page write.

eg. writing a 64kB file as follows would be very slow:

for(i = 0; i < 64000; i++)
{
h = open("xx",...O_APPEND);
write(h,&b,1);
close(h);
}

would cost two page writes for every useful byte written.

I expect you're not being as cruel as this, but check for places where you
are doing unnecessary flushes and closes.

If you suspect the Linux cache might not be effective for your purposes (or
would like to play :-)), you might also try the caching built in to YAFFS.
This caching is normally used only by YAFFS direct and WinCE (which do not
have OS-level caching).

This can be enabled by adding the line
dev->nShortOpCaches=10; // or some number <=20;
somewhere around line 1248 in yaffs_fs.c

On WinCE devices, this vastly improved situations where short writes were
being used (by a factor of 15 or so).

-- Charles






---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by
sending an email to with the text "unsubscribe"
(without the quotes) as the subject.