public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: linux-fsdevel@vger.kernel.org
Subject: Re: Page cache and write
Date: Mon, 19 May 2003 22:27:33 +0200	[thread overview]
Message-ID: <20030519202733.GC944@vagabond> (raw)
In-Reply-To: <20030519201144.4DA04437A@blood.actrix.co.nz>

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>

      reply	other threads:[~2003-05-19 20:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-19 20:13 Page cache and write Charles Manning
2003-05-19 20:27 ` Jan Hudec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030519202733.GC944@vagabond \
    --to=bulb@ucw.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox