+
+ [ -n "$OPT_POOL" ] ||
+ stripe_pool=$($LFS getstripe -p "$OLDNAME" 2>/dev/null)
+ mirror_count=$($LFS getstripe -N "$OLDFILE" 2>/dev/null)
+
+ if $OPT_AUTOSTRIPE; then
+ local filekb=$((${nlink_type[$nlink_idx_size]} /
+ 1024))
+
+ read stripe_count OBJ_MAX_KB < <(calc_stripe \
+ "$OLDNAME" "$filekb" "$OBJ_MAX_KB")
+ [ -z "$stripe_count" ] && exit 1
+ [ $stripe_count -lt 1 ] && stripe_count=1
+ else
+ [ -n "$stripe_count" ] ||
+ stripe_count=$($LFS getstripe -c "$OLDNAME" \
+ 2> /dev/null)
+ fi
+ [ -n "$stripe_size" ] ||
+ stripe_size=$($LFS getstripe -S "$OLDNAME" 2> /dev/null)
+
+ [ -z "$stripe_count" -o -z "$stripe_size" ] && UNLINK=""
+ fi
+
+ if $OPT_DEBUG; then
+ local parent_count
+ local parent_size
+
+ if $OPT_RESTRIPE; then
+ parent_count=$($LFS getstripe -c \
+ $(dirname "$OLDNAME") 2> \
+ /dev/null)
+ parent_size=$($LFS getstripe -S \
+ $(dirname "$OLDNAME") 2> \
+ /dev/null)
+ stripe_pool=$($LFS getstripe --pool \
+ $(dirname "$OLDNAME") 2> \
+ /dev/null)
+ mirror_count=$($LFS getstripe -N \
+ $(dirname "$OLDFILE") 2> \
+ /dev/null)
+ fi
+
+ $ECHO -n "stripe_count=${stripe_count:-$parent_count},stripe_size=${stripe_size:-$parent_size}"
+ [ -n "$stripe_pool" ] &&
+ $ECHO -n ",pool=${stripe_pool}"
+ [ -n "$mirror_count" ] &&
+ $ECHO -n ",mirror_count=${mirror_count}"
+ $ECHO -n " "
+ fi
+
+ if $OPT_DRYRUN; then
+ $ECHO " dry run, skipped"
+ continue
+ fi
+
+ layout="${OPT_PASSTHROUGH[@]} "
+ [ -n "$stripe_count" ] && layout+="-c $stripe_count "
+ [ -n "$stripe_size" ] && layout+="-S $stripe_size "
+ [ -z "$OPT_POOL" -a -n "$stripe_pool" ] &&
+ layout+="-p $stripe_pool "
+ [ -n "$mirror_count" ] && layout+="-N $mirror_count "
+ layout+="$OPT_LAYOUT"
+
+ # detect other hard links and store them on a global
+ # list so we don't re-migrate them
+ if [[ ${nlink_type[$nlink_idx_link]} -gt 1 ]]; then
+ [ "${nlink_type[$nlink_idx_dev]}" == "$last_dev" ] ||
+ mntpoint=$(df -P "$OLDNAME" |
+ awk 'NR==2 { print $NF }')
+ if [ -z "$mntpoint" ]; then
+ echo -e "\r$OLDNAME: cannot determine mount point; skipped" 1>&2
+ continue
+ fi
+ hlinks=$($LFS fid2path "$mntpoint" "$fid" 2> /dev/null)
+ if $OPT_RSYNC && [ $? -ne 0 ]; then
+ echo -e "\r$OLDNAME: cannot determine hard link paths, skipped" 1>&2
+ continue
+ fi
+ hlinks+=("$OLDNAME")
+ else
+ hlinks=