Re: RAID1 ramdisk patch

From: Neil Brown
Date: Sun Sep 04 2005 - 20:29:19 EST


On Monday September 5, wilco@xxxxxxxxxxxxx wrote:
> Hi all,
>
> I have written a small patch for use with a HDD-backed ramdisk in the md
> raid1 driver. The raid1 driver usually does read balancing on the disks,
> but I feel that if it encounters a single ram disk in the array that
> should be the preferred read disk. The application of this would be for
> example a 2GB ram disk in raid1 with a 2GB partition, where the ram disk
> is used for reading and both 'disks' used for writing.
>
> Attached is a bit of code which checks for a ram-disk and sets it as
> preferred disk. It also checks if the ram disk is in sync before
> allowing the read.

Hi,
equivalent functionality is now available in 2.6-mm and is referred
to as 'write mostly'.
If you use mdadm-2.0 and mark a device as --write-mostly, then all
read requests will go to the other device(s) if possible,.
e.g.
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/ramdisk \
--writemostly /dev/realdisk

Does this suit your needs?

You can also arrange for the write to the writemostly device to be
'write-behind' so that the filesystem doesn't wait for the write to
complete. This can reduce write-latency (though not increase write
throughput) at a very small cost of reliability (if the RAM dies, the
disk may not be 100% up-to-date).

NeilBrown

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/