Re: How to flush the disk write cache from userspace

From: Ricardo Correia
Date: Wed Jan 17 2007 - 21:08:29 EST


On Tuesday 16 January 2007 00:38, you wrote:
> As always with these things, the devil is in the details. It requires
> the device to support a ->prepare_flush() queue hook, and not all
> devices do that. It will work for IDE/SATA/SCSI, though. In some devices
> you don't want/need to do a real disk flush, it depends on the write
> cache settings, battery backing, etc.

Is there any chance that someone could implement this (I don't have the
skills, unfortunately)? Maybe add a new ioctl() to block devices, so that it
doesn't break any existing code?

I believe it's a very useful (and relatively simple) feature that increases
data integrity and reliability for applications that need this functionality.

I think it must be considered that most people have disk write caches enabled
and are using IDE, SATA or SCSI disks.

I also think there's no point in disabling disks' write caches, since it slows
writes and decreases disks' lifetime, and because there's a better solution.

Personally, I'm not really interested in specific filesystem behaviour, since
my application uses block devices directly (it's a filesystem itself).
Although I think all filesystems should guarantee data integrity in the face
of fsync() or metadata modifications, even if it costs a little performance.

Thank you.
-
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/