Subject: Re: optimistic dd bandwidth calculation
To: Johan Danielsson <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 07/18/2002 13:33:14
[ On , July 18, 2002 at 16:45:56 (+0200), Johan Danielsson wrote: ]
> Subject: optimistic dd bandwidth calculation
> Does this look correct (this is in dd_close)?
> --- dd.c 2002/01/10 03:25:12 1.26
> +++ dd.c 2002/07/18 14:44:46
> @ -360,6 +360,8 @
> if (out.dbcnt)
> + if(fsync(out.fd) < 0)
> + err(1, "%s", out.name);
No, absolutely not. I almost never want dd to always hang while waiting
for fsync() before it finishes!
If you always wish the stats to be accurate w.r.t. low-level I/O rates,
(and/or have some desire to make sure that your data is safely committed
to storage before dd exits), it may make sense to add an "fsync" option,
perhaps to the already overloaded "conv=" parameter. I've thought of
doing this several times, but have never got around to it.
If you add such an option then it may make sense to call fsync(out.fd)
in the SIGINFO handler when it's set too, i.e. before reporting the
stats, and given the way the code's written that would be the only call
necessary (since summary(), the SIGINFO handler, is called at exit()
time because it's been registered with atexit()).
Greg A. Woods
+1 416 218-0098; <firstname.lastname@example.org>; <email@example.com>
Planix, Inc. <firstname.lastname@example.org>; VE3TCP; Secrets of the Weird <email@example.com>