Re: [PATCH] generic: LVM and ram disks don't play well

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Tue, Apr 07, 2015 at 11:56:50AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> 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
						
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux