From: Theodore Ts'o <tytso@mit.edu>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic: LVM and ram disks don't play well
Date: Tue, 7 Apr 2015 23:57:13 -0400 [thread overview]
Message-ID: <20150408035713.GF21171@thunk.org> (raw)
In-Reply-To: <1428371810-11085-1-git-send-email-david@fromorbit.com>
On Tue, Apr 07, 2015 at 11:56:50AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> The "brd" kernel ram disk abuses BLKFLSBUF to mean "free all memory
> in the ram drive" when in fact it actually means "flush all dirty
> buffers to stable storage".
Actually, what BLKFLSBUF means is to "flush all dirty buffers to
stable storage --- and then invalidate/kill all buffers for the
underyling block device."
The reason why the ramdisk driver has special semantics BLKFLSBUF is
an accident of how it was originally implemented, back in the 0.1x
days of Linux, where it was implemented as a set of buffers in the
buffer cache that weren't actually backed by any device. Since they
were marked dirty, they wouldn't actually get dropped by the buffer
cache. It was a dirty hack, but back in the days where they were used
to populate the ramdisk from a floppy disk, it worked well enough.
It happened that how BLKFLSBUF was implemented, without having to do
anything special, the fact that BLKFLSBUF would invalidate all of the
buffers from the buffer cache, userspace code would use this as a way
of causing the ram disk to release memory.
Given the desire not to break userspace, when the brd device was
implemented to no longer depend on the buffer cache, the "special"
semantics of BLKFLSBUF were preserved. We probably should have
allocated a new ioctl for the explicit purpose of releasing memory,
and then tracked down all users of the magic BLKFLSBUF ioctl. I don't
think there should be that many --- in fact, it may very well be that
init/do_mounts_initrd.c in the kernel sources might be one of the few
still around, since the days of boot/root floppies are long before us.
Cheers,
- Ted
prev parent reply other threads:[~2015-04-08 3:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 1:56 [PATCH] generic: LVM and ram disks don't play well Dave Chinner
2015-04-07 13:16 ` Brian Foster
2015-04-08 3:57 ` Theodore Ts'o [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=20150408035713.GF21171@thunk.org \
--to=tytso@mit.edu \
--cc=david@fromorbit.com \
--cc=fstests@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