Re: [PATCH] md5: accepts a new --threads option (original) (raw)

[Top][All Lists]


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Pádraig Brady
Subject: Re: [PATCH] md5: accepts a new --threads option
Date: Wed, 21 Oct 2009 13:04:23 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Jim Meyering wrote:

Pádraig Brady wrote: > Jim Meyering wrote: >> Pádraig Brady wrote: >>> Pádraig Brady wrote: >>>> You wouldn't want multiple threads/processes fighting over >>>> the disk head so you would do something like: >>>> >>>> find /disk1 | xargs md5sum & find /disk2 | xargs md5sum >>>> >>>> Note if we're piping/redirecting the output of the above >>>> then we must be careful to line buffer the output from md5sum >>>> so that it's not interspersed. Hmm I wonder should >>>> we linebuffer the output from *sum by default. >>> In the attached patch, I've changed the default buffering >>> to line buffered to address the above issue. For standard >>> size files there is a 2% performance drop. >> Good catch. >> It sounds like this fixes a real (albeit obscure) bug, so this >> might deserve a NEWS item, though I admit it is borderline. > Well it would easily be hit when one tries to parallelize the processes. > So I'll add a NEWS item and a test along the lines of:

Thanks!

> (mkdir t && cd t && seq 100 | xargs touch) _> (find t t t t -type f | xargs -n100 -P4 md5sum) _ > | sed -n '/[0-9a-f]{32} /!p' | grep . >/dev/null && fail=1

Odd... that doesn't fail on any of the systems where I tried it: rawhide, fedora 11, debian unstable.

Yep I noticed it triggered on my linux-2.6.22 glibc-2.6-1 box but not on my F11 laptop. I've setup the test in the attached to output more than 16KiB per process which triggers on F11 at least.

cheers, Pádraig.

From 83085a61c1251f95bd324cd50f57c5154645a1b3 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden> Date: Tue, 20 Oct 2009 19:19:58 +0100 Subject: [PATCH] md5sum, sha*sum, sum: line-buffer the printed checksums


NEWS | 5 +++++ src/md5sum.c | 6 ++++-- src/sum.c | 4 ++++ tests/Makefile.am | 1 + tests/misc/md5sum-parallel | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 tests/misc/md5sum-parallel

1.6.2.5