public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sascha Nitsch <Sash_lkl@linuxhowtos.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Idea about a disc backed ram filesystem
Date: Thu, 8 Jun 2006 22:33:13 +0200	[thread overview]
Message-ID: <200606082233.13720.Sash_lkl@linuxhowtos.org> (raw)

Hi,

this is (as of this writing) just an idea.

=== current state ===
Currently we have ram filesystems (like tmpfs) and disc based file systems
(ext2/3, xfs, <insert your fav. fs>).

tmpfs is extremely fast but suffers from data losses from restarts, crashes
and power outages. Disc access is slow against a ram based fs.

=== the idea ===
My idea is to mix them to the following hybrid:
- mount the new fs over an existing dir as an overlay
- all files overlayed are still accessible
- after the first read, the file stays in memory (like a file cache)
- all writes are flushed out to the underlying fs (maybe done async)
- all reads are always done from the memory cache unless they are not cached
  yet
- the cache stays until the partition is unmounted
- the maximum size of the overlayed filesystem could be physical ram/2 (like tmpfs)

=== advantages ===
once the files are read, no more "slow" disc reading is needed=> huge read
speed improvements (like on tmpfs)
if the writing is done asyncronous, write speeds would be as fast as a
tmpfs => huge write speedup
if done syncronous, write speed almost as fast as native disc fs
the ram fs would be imune against data loss from reboots or controled shutdown
if syncronous write is done, the fs would be imune to crashes/power
outages (with the usual exceptions like on disc fs)

=== disadvantage ===
possible higher memory usage (see implementation ideas below)

=== usages ===
possible usage scenarios could be any storage where a
smaller set of files get read/written a lot, like databases
definition of smaller: lets say up to 50% of physical ram size.
Depending on architecture and money spent, this can be a lot :)

=== implementation ideas ===
One note first:
I don't know the fs internals of the kernel (yet), so these ideas might not
work, but you should get the idea.

One idea is to build a complete virtual filesystem that connects to the VFS
layer and hands the writes through to the "original" fs driver.
The caching would be done in that layer. This might cause double caching
(in the io cache) and might waste memory.
But this idea would enable the possibility of async writes (when the disc has
less to do) and gives write speed improves.

The other idea would be to modify the existing filesystem cache algorithm to
have a flag "always keep this file in memory".

The second one may be easier to do and may cause less side effects, but
might not enable async writes.

Since this overlay is done in the kernel, no other process could change the
files under the overlay.
Remote FS must be excluded from the cache layer (for obvious reasons).

Any kind of feedback is welcome.

If this has been discussed earlier, sorry for double posting. I haven't found
anything like this in the archives. Just point me in the right direction.

Regards,

Sascha Nitsch

             reply	other threads:[~2006-06-08 20:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Sash_lkl@linuxhowtos.org>
2006-06-08 20:33 ` Sascha Nitsch [this message]
2006-06-08 20:43   ` Idea about a disc backed ram filesystem Lennart Sorensen
2006-06-08 21:12     ` Sash
2006-06-09 10:45       ` Jan Engelhardt
2006-06-08 21:51   ` Horst von Brand
2006-06-08 22:39     ` Joshua Hudson
2006-06-08 22:48   ` Matheus Izvekov
2006-06-08 23:40     ` Måns Rullgård
2006-06-09  1:01       ` Matheus Izvekov
2006-06-09  8:52         ` Måns Rullgård
2006-06-09  2:17     ` Horst von Brand
2006-06-09  4:59       ` Matheus Izvekov
2006-06-09 13:43         ` Horst von Brand
2006-06-09 15:07           ` Matheus Izvekov
2006-06-09 18:43             ` Lee Revell
2006-06-09 19:27               ` Matheus Izvekov
2006-06-09 19:31                 ` Lee Revell
2006-06-09 19:43                   ` Matheus Izvekov
2006-06-09 20:03                     ` Lee Revell
2006-06-09 21:23                       ` Matheus Izvekov
2006-06-09 23:37             ` Horst von Brand
2006-06-09  6:33   ` Andi Kleen

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=200606082233.13720.Sash_lkl@linuxhowtos.org \
    --to=sash_lkl@linuxhowtos.org \
    --cc=linux-kernel@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