[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Don't do unneccesary memory copies in dd.
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] Don't do unneccesary memory copies in dd. |
Date: |
Fri, 21 Nov 2008 23:00:11 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Paul Eggert wrote:
> $ (echo 'x'; sleep 10; echo y) | dd ibs=3 obs=3
>
> POSIX says that in this case the output data must be reblocked into
> blocks of 3 bytes. With the working 'dd', you'll see a pause of 10
> seconds (because the first 'echo' outputs only 2 bytes), then the x and
> y right away (because we now have all 4 input bytes, and can issue a
> write of 3 bytes and a write of 1 byte). With a buggy 'dd', you'll see
> the 'x' right away (because we output a 2-byte block), then a pause of
> 10 seconds, then a 'y' (the other 2-byte block).
>
> The simplest fix I see is to revert the patch. Of course one could up
> with something fancier....
>
Thanks for that Paul.
That certainly isn't obvious, and deserves a comment in the code.
A question so on the default behaviour of dd.
Should it behave like bs=512 or ibs=512 obs=512,
i.e. should it memcpy/reblock by default?
cheers,
Pádraig.