dd and O_DIRECT

Denys Vlasenko vda.linux at googlemail.com
Thu Oct 16 10:07:57 UTC 2008


On Thursday 16 October 2008 10:58:36 am Richard Kojedzinszky wrote:
> dear all,
> 
> Is there any possibility to busybox's dd support the iflag= and oflag= 
> options, especially with the direct flag? I need to read a block device 
> with O_DIRECT, and it would be nice to dd support that.

I agree with Linus on this one - O_DIRECT is a Wrong Thing to Do,
and should not have been created from the start.

Instead of asking to read/write "directly" to the device,
(what is "directly"? There is no unambiguous answer to that)
there should be a flag "I will be reading/writing a lot
and in huge chunks, do not bother caching this data".
And maybe another flag "kernel, if I feed you badly aligned buffer
and you can't use DMA efficiently because of this,
please error out so that I know that".

One of the above, or both, is what you guys imply
when you say "I need to use O_DIRECT". Don't tell kernel
hot to do its work. Tell it what you want to achieve.

But Oracle monkeys won this one for now. :(

I will accept patches which implement iflag= and oflag=
and O_DIRECT support for busybox dd, but I'm not inclined
to write them myself.
--
vda



More information about the busybox mailing list