From: Andreas Dilger Date: Wed, 8 Mar 2017 00:12:18 +0000 (-0700) Subject: LU-6051 utils: improve efficiency of lfs_migrate cmp X-Git-Tag: 2.9.55~15 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F25878%2F2;p=fs%2Flustre-release.git LU-6051 utils: improve efficiency of lfs_migrate cmp 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 Change-Id: I424538388d7e31609fa1f875128f03fef33ebbe5 Reviewed-on: https://review.whamcloud.com/25878 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Minh Diep Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- diff --git a/lustre/scripts/lfs_migrate b/lustre/scripts/lfs_migrate index e9c8aae..f9cf91c 100755 --- a/lustre/scripts/lfs_migrate +++ b/lustre/scripts/lfs_migrate @@ -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