[PATCH FOR REVIEW]: Unnecessary calls to sync()

Andrew John Hughes ahughes at redhat.com
Mon Jun 7 18:17:33 UTC 2010

Is it really necessary for the sanity script to be flushing all
buffers to disc on GNU/Linux boxes?

 ifeq ($(PLATFORM), linux)
  FREE_SPACE := $(shell $(DF) --sync -kP $(OUTPUTDIR) | $(TAIL) -1 |
$(NAWK) '{print $$4;}')
  TEMP_FREE_SPACE := $(shell $(DF) --sync -kP $(TEMP_DISK) | $(TAIL)
-1 | $(NAWK) '{print $$4;}')

If the disc being used to build is in heavy use, this stalls the build.

The documentation for GNU df (used on GNU/Linux) states:

     Invoke the `sync' system call before getting any usage data.  On
     some systems (notably SunOS), doing this yields more up to date
     results, but in general this option makes `df' much slower,
     especially when there are many or very busy file systems.

Do we really need this check to be that accurate that we stall the
entire build to find out the exact disc space?  If there is a lot of
disc traffic, this can stall for a very long time (it was certainly
noticeable just now, when the build went nowhere for about half an
hour because another build was ongoing).

Note that this is specific to GNU/Linux for some reason; there is no
sync on Solaris:

ifeq ($(PLATFORM), solaris)
  FREE_SPACE := $(shell $(DF) -b $(OUTPUTDIR) | $(TAIL) -1 | $(NAWK)
'{print $$2;}')
  TEMP_FREE_SPACE := $(shell $(DF) -b $(TEMP_DISK) | $(TAIL) -1 |
$(NAWK) '{print $$2;}')

whereas the documentation for GNU df suggests it might be more useful
there on older versions.

Can we please apply the following webrev:


and drop this option?  If so, I need a bug ID for this.

Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

More information about the build-dev mailing list