From bae7c41a5126c56da4ee77bce39955036fca8b5f Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 2 Mar 2021 16:31:39 -0600 Subject: [PATCH 2/5] copy: Nicer sort Tell sort where the numbers live, so we can get columns in ascending numeric order. Improves 8b20bbd329. --- copy/copy-sparse-no-extents.sh | 12 ++++++------ copy/copy-sparse-request-size.sh | 20 ++++++++++---------- copy/copy-sparse.sh | 18 +++++++++--------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/copy/copy-sparse-no-extents.sh b/copy/copy-sparse-no-extents.sh index cdc132b..4dc5c88 100755 --- a/copy/copy-sparse-no-extents.sh +++ b/copy/copy-sparse-no-extents.sh @@ -50,22 +50,21 @@ $VG nbdcopy --no-extents -S 0 -- \ trim=" echo \$@ >> $out " \ zero=" echo \$@ >> $out " ] -sort -n -o $out $out +LC_ALL=C sort -k1,1 -k2,2n -k3,3n -o $out $out echo Output: cat $out if [ "$(cat $out)" != "pwrite 33554432 0 +pwrite 33554432 33554432 +pwrite 33554432 67108864 pwrite 33554432 100663296 -pwrite 33554432 1006632960 -pwrite 33554432 1040187392 pwrite 33554432 134217728 pwrite 33554432 167772160 pwrite 33554432 201326592 pwrite 33554432 234881024 pwrite 33554432 268435456 pwrite 33554432 301989888 -pwrite 33554432 33554432 pwrite 33554432 335544320 pwrite 33554432 369098752 pwrite 33554432 402653184 @@ -76,7 +75,6 @@ pwrite 33554432 536870912 pwrite 33554432 570425344 pwrite 33554432 603979776 pwrite 33554432 637534208 -pwrite 33554432 67108864 pwrite 33554432 671088640 pwrite 33554432 704643072 pwrite 33554432 738197504 @@ -86,7 +84,9 @@ pwrite 33554432 838860800 pwrite 33554432 872415232 pwrite 33554432 905969664 pwrite 33554432 939524096 -pwrite 33554432 973078528" ]; then +pwrite 33554432 973078528 +pwrite 33554432 1006632960 +pwrite 33554432 1040187392" ]; then echo "$0: output does not match expected" exit 1 fi diff --git a/copy/copy-sparse-request-size.sh b/copy/copy-sparse-request-size.sh index f2e2b61..78a066a 100755 --- a/copy/copy-sparse-request-size.sh +++ b/copy/copy-sparse-request-size.sh @@ -50,13 +50,21 @@ $VG nbdcopy --no-extents -S 0 --request-size=1048576 -- \ trim=" echo \$@ >> $out " \ zero=" echo \$@ >> $out " ] -LC_ALL=C sort -n -o $out $out +LC_ALL=C sort -k1,1 -k2,2n -k3,3n -o $out $out echo Output: cat $out if [ "$(cat $out)" != "pwrite 1048576 0 pwrite 1048576 1048576 +pwrite 1048576 2097152 +pwrite 1048576 3145728 +pwrite 1048576 4194304 +pwrite 1048576 5242880 +pwrite 1048576 6291456 +pwrite 1048576 7340032 +pwrite 1048576 8388608 +pwrite 1048576 9437184 pwrite 1048576 10485760 pwrite 1048576 11534336 pwrite 1048576 12582912 @@ -67,7 +75,6 @@ pwrite 1048576 16777216 pwrite 1048576 17825792 pwrite 1048576 18874368 pwrite 1048576 19922944 -pwrite 1048576 2097152 pwrite 1048576 20971520 pwrite 1048576 22020096 pwrite 1048576 23068672 @@ -78,15 +85,8 @@ pwrite 1048576 27262976 pwrite 1048576 28311552 pwrite 1048576 29360128 pwrite 1048576 30408704 -pwrite 1048576 3145728 pwrite 1048576 31457280 -pwrite 1048576 32505856 -pwrite 1048576 4194304 -pwrite 1048576 5242880 -pwrite 1048576 6291456 -pwrite 1048576 7340032 -pwrite 1048576 8388608 -pwrite 1048576 9437184" ]; then +pwrite 1048576 32505856" ]; then echo "$0: output does not match expected" exit 1 fi diff --git a/copy/copy-sparse.sh b/copy/copy-sparse.sh index 5f12bad..1a6da86 100755 --- a/copy/copy-sparse.sh +++ b/copy/copy-sparse.sh @@ -50,7 +50,7 @@ $VG nbdcopy -S 0 -- \ # Order of the output could vary because requests are sent in # parallel. -LC_ALL=C sort -n -o $out $out +LC_ALL=C sort -k1,1 -k2,2n -k3,3n -o $out $out echo Output: cat $out @@ -61,11 +61,16 @@ pwrite 32768 0 pwrite 32768 1073709056 pwrite 32768 4294934528 zero 134184960 32768 may_trim -zero 134184960 4160749568 may_trim zero 134184960 939524096 may_trim +zero 134184960 4160749568 may_trim +zero 134217728 134217728 may_trim +zero 134217728 268435456 may_trim +zero 134217728 402653184 may_trim +zero 134217728 536870912 may_trim +zero 134217728 671088640 may_trim +zero 134217728 805306368 may_trim zero 134217728 1073741824 may_trim zero 134217728 1207959552 may_trim -zero 134217728 134217728 may_trim zero 134217728 1342177280 may_trim zero 134217728 1476395008 may_trim zero 134217728 1610612736 may_trim @@ -76,7 +81,6 @@ zero 134217728 2147483648 may_trim zero 134217728 2281701376 may_trim zero 134217728 2415919104 may_trim zero 134217728 2550136832 may_trim -zero 134217728 268435456 may_trim zero 134217728 2684354560 may_trim zero 134217728 2818572288 may_trim zero 134217728 2952790016 may_trim @@ -87,11 +91,7 @@ zero 134217728 3489660928 may_trim zero 134217728 3623878656 may_trim zero 134217728 3758096384 may_trim zero 134217728 3892314112 may_trim -zero 134217728 402653184 may_trim -zero 134217728 4026531840 may_trim -zero 134217728 536870912 may_trim -zero 134217728 671088640 may_trim -zero 134217728 805306368 may_trim" ]; then +zero 134217728 4026531840 may_trim" ]; then echo "$0: output does not match expected" exit 1 fi -- 2.29.0.rc2