Merge pull request #127744 from cransom/disk-image-faster

make-disk-image: Reduce forking
This commit is contained in:
Robert Hensing 2021-06-26 08:31:12 +02:00 committed by GitHub
commit c1a75084ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -278,7 +278,7 @@ let format' = format; in let
additionalSpace=$(( $(numfmt --from=iec '${additionalSpace}') + reservedSpace ))
# Compute required space in filesystem blocks
diskUsage=$(find . ! -type d -exec 'du' '--apparent-size' '--block-size' "${blockSize}" '{}' ';' | cut -f1 | sum_lines)
diskUsage=$(find . ! -type d -print0 | du --files0-from=- --apparent-size --block-size "${blockSize}" | cut -f1 | sum_lines)
# Each inode takes space!
numInodes=$(find . | wc -l)
# Convert to bytes, inodes take two blocks each!