Hi!

On 03/14/2017 06:44 PM, Rostislav Skudnov wrote:
Signed-off-by: Rostislav Skudnov <rostis...@tuxera.com>

It would probably be useful to tell why this change was made: it makes the behavior consistent with coreutils dd and fixes performance problems caused by calling fsync() over and over again.

---
 coreutils/dd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/coreutils/dd.c b/coreutils/dd.c
index 5e68087..d89c0ae 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -532,17 +532,17 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
                        if (write_and_stats(ibuf, n, obs, outfile))
                                goto out_status;
                }
-
-               if (G.flags & FLAG_FSYNC) {
-                       if (fsync(ofd) < 0)
-                               goto die_outfile;
-               }
        }

        if (ENABLE_FEATURE_DD_IBS_OBS && oc) {
                if (write_and_stats(obuf, oc, obs, outfile))
                        goto out_status;
        }
+
+       if (G.flags & FLAG_FSYNC) {
+               if (fsync(ofd) < 0)
+                       goto die_outfile;
+       }
        if (close(ifd) < 0) {
  die_infile:
                bb_simple_perror_msg_and_die(infile);


Maybe a blank line between the closing brace and the next if statement to make the look more consistent?

Best regards,
Ari Sundholm
a...@tuxera.com
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to