Subject: Re: bug#7421: [Feature request]: add option to dd to issue ioctl(BLKFLSBUF) on output descriptior after each write or at the end

From: Pádraig Brady <[email-masked]>
Date: Sun, 25 Jan 2015 18:41:52 +0000

unarchive 7421
tag 7421 wontfix
close 7421
stop

On 17/11/10 10:41, Марк Коренберг wrote:
> [Feature request]: add option to dd to issue ioctl(BLKFLSBUF) on
> output descriptior after each write or at the end
> 
> I already has sent a message about fsync/fdatasync after each write.
> It seems that ioctl(BLKFLSBUF) need be implemented in same semantics.
> 
> in oflags and conv
> i.e. ioctl after each write oflags=blkflsbuf
> and ioctl at the end, if specified in conv=blkflsbuf

This is already supported with the `blockdev --flushbufs` command.
Given this is a low level linux specific interface, it's more suited
to the blockdev command than a more general tool like dd.
Note ioctl(BLKFLSBUF) only writes out dirty pages to the block device,
it doesn't guarantee to send a flush request to the device.
Also http://lwn.net/Articles/433384/ mentions that BLKFLSBUF also
invalidates the bdev mapping, which isn't generally desirable,
and doesn't work for non-block file systems.

We're considering adding syncfs() support to the sync command
which should cater for much of the use case you describe here:
That's discussed at http://bugs.gnu.org/19681

thanks,
Pádraig.