public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* Page cache and write
@ 2003-05-19 20:13 Charles Manning
  2003-05-19 20:27 ` Jan Hudec
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Manning @ 2003-05-19 20:13 UTC (permalink / raw)
  To: linux-fsdevel

When writing the YAFFS NAND file system, I added an internal caching layer 
that caches both short reads and writes. This is used in most situations, but 
not in Linux.

Under Linux, YAFFS uses generic_file_read and generic_file_write and thus any 
caching is provided bythe page cache. It was my understanding that the page 
cache will cache up writes. However, from the experiences of some YAFFS users 
this is not the case and enabling the YAFFS internal caching resulted in 
dramatic speedup (eg 15 seconds-> 3 seconds for a certain code sequence).

I now want to understand whether I should enable internal caching in YAFFS or 
whether I should be using the page cache differently.

Consider the code

  for(i=0; i < 1000; i++)
       write(f,b,1);

On a flash file system this would take a long time if each write goes all the 
way to the fs. I assume too that this code does not result in 1000 disk 
writes on a regular file system (eg ext2).

Questions: Does the page cache do anything to help in this case?

Question: Assuming ext2 does not do 1000 physical writes to disk, where does 
the consolidation happen?

Thanx

-- Charles.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Page cache and write
  2003-05-19 20:13 Page cache and write Charles Manning
@ 2003-05-19 20:27 ` Jan Hudec
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hudec @ 2003-05-19 20:27 UTC (permalink / raw)
  To: linux-fsdevel

On Tue, May 20, 2003 at 08:13:45AM +1200, Charles Manning wrote:
> When writing the YAFFS NAND file system, I added an internal caching layer 
> that caches both short reads and writes. This is used in most situations, but 
> not in Linux.
> 
> Under Linux, YAFFS uses generic_file_read and generic_file_write and thus any 
> caching is provided bythe page cache. It was my understanding that the page 
> cache will cache up writes. However, from the experiences of some YAFFS users 
> this is not the case and enabling the YAFFS internal caching resulted in 
> dramatic speedup (eg 15 seconds-> 3 seconds for a certain code sequence).
> 
> I now want to understand whether I should enable internal caching in YAFFS or 
> whether I should be using the page cache differently.
> 
> Consider the code
> 
>   for(i=0; i < 1000; i++)
>        write(f,b,1);
> 
> On a flash file system this would take a long time if each write goes all the 
> way to the fs. I assume too that this code does not result in 1000 disk 
> writes on a regular file system (eg ext2).
> 
> Questions: Does the page cache do anything to help in this case?
> 
> Question: Assuming ext2 does not do 1000 physical writes to disk, where does 
> the consolidation happen?

Writes through page-cache work like this: When a page should be written
to, it is first read. Then the modification is made in memory and the
page is marked dirty. When something gets to it, it writes the page to
disk. The something might be either memory allocator when it desperately
needs a page or a bdflush when it decides the page is dirty for too
long. (Hope I don't remember it too wrong).

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-19 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-19 20:13 Page cache and write Charles Manning
2003-05-19 20:27 ` Jan Hudec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox