Re: PATCH: Ramdisk version 2.0.1

Theodore Y. Ts'o (tytso@mit.edu)
Thu, 4 Jul 1996 00:08:07 -0400


From: greg@wind.rmcc.com (G.W. Wettstein)
Date: Mon, 1 Jul 1996 12:39:22 CDT

I had a question on a related note. I find the new ramdisk code very
useful but it has been unclear how to make the entity go away
completely? It seems that the ramdisk gets swapped away but I have
never been able to make its consumption of swap space go away.

If the ramdisk is compiled as a module, all of the blocks will be
released when the module is unloaded.

You can also use the ioctl BLKFLSBUF to make the memory pages used by
ramdisk go away. (Note that ramdisk doesn't use swap space; it uses
kernel memory pages.) It's important to remember that BLKFLSBUF on
normal disk devices causes the buffer cache for that device to be
flushed, but they can always be reread in from the device. However,
BLKFLSBUF on a ramdisk makes the data in the ram disk go away
permanently.

We probably should have used a different ioctl, because these two
meanings *are* different, and the results could be quite disastrous if a
program were to call the ioctl expecting one behavior, and it got
another. Fortunately, that ioctl isn't used often by most programs.

- Ted