Re: RAID1 ramdisk patch

From: Wilco Baan Hofman
Date: Mon Sep 05 2005 - 02:40:59 EST


Neil Brown wrote:

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



I was looking for that (but couldn't find it)..

At this point I don't see why it wouldn't, if that also syncs from the partition then it's basically the same functionality, but written from a different perspective.

To use it I'll have to deviate from stock linux and use a non-packaged mdadm, but that is better than applying my patch every kernel update ;-)

Thanks, I'll look into it.

Wilco Baan Hofman
-
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/