Whamcloud - gitweb
LU-6051 utils: improve efficiency of lfs_migrate cmp 78/25878/2
authorAndreas Dilger <andreas.dilger@intel.com>
Wed, 8 Mar 2017 00:12:18 +0000 (17:12 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 26 Mar 2017 06:50:53 +0000 (06:50 +0000)
The file comparison used by lfs_migrate could be more efficient by
using the "cmp -s" option to avoid printing byte-by-byte differences.
This allows faster comparisons via memcmp() and comparing the file
size.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I424538388d7e31609fa1f875128f03fef33ebbe5
Reviewed-on: https://review.whamcloud.com/25878
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/scripts/lfs_migrate

index e9c8aae..f9cf91c 100755 (executable)
@@ -177,7 +177,7 @@ lfs_migrate() {
                        exit 4
                fi
 
-               if [ "$OPT_CHECK" ] && ! cmp "$OLDNAME" "$NEWNAME"; then
+               if [ "$OPT_CHECK" ] && ! cmp -s "$OLDNAME" "$NEWNAME"; then
                        echo -e "\r$NEWNAME: compare failed, exiting" 1>&2
                        exit 8
                fi