From d7c74441a59b71c6371c9a5da09a9303567ec0c5 Mon Sep 17 00:00:00 2001 From: undaunt <31376520+undaunt@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:48:53 -0800 Subject: [PATCH] Fix echo bug Removed the 'recreating hardlinks' echo for inode groups of 1 file. --- zfs-inplace-rebalancing.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/zfs-inplace-rebalancing.sh b/zfs-inplace-rebalancing.sh index c968a0d..2346aad 100755 --- a/zfs-inplace-rebalancing.sh +++ b/zfs-inplace-rebalancing.sh @@ -165,13 +165,16 @@ function process_inode_group() { fi mv "${tmp_file_path}" "${main_file}" - echo "Recreating hardlinks..." - for (( i=1; i<${#paths[@]}; i++ )); do - if [ "$debug_flag" = true ]; then - echo "Linking ${main_file} to ${paths[$i]}" - fi - ln "${main_file}" "${paths[$i]}" - done + # Only recreate hardlinks if there are multiple paths + if [ "${num_paths}" -gt 1 ]; then + echo "Recreating hardlinks..." + for (( i=1; i<${#paths[@]}; i++ )); do + if [ "$debug_flag" = true ]; then + echo "Linking ${main_file} to ${paths[$i]}" + fi + ln "${main_file}" "${paths[$i]}" + done + fi if [ "${passes_flag}" -ge 1 ]; then # Update rebalance "database" for all files