check_stripe_count $TDIR/file1 $expected
+ if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.90) ];
+ then
+ # lfs_migrate file onto OST 0 if it is on OST 1, or onto
+ # OST 1 if it is on OST 0. This file is small enough to
+ # be on only one stripe.
+ file=$TDIR/migr_1_ost
+ dd bs=$dd_bs count=1 if=/dev/urandom of=$file >/dev/null 2>&1 ||
+ error "write data into $file failed"
+ local obdidx=$($LFS getstripe -i $file)
+ local oldmd5=$(md5sum $file)
+ local newobdidx=0
+ [[ $obdidx -eq 0 ]] && newobdidx=1
+ cmd="$LFS migrate -i $newobdidx $file"
+ echo $cmd
+ eval $cmd || error "$cmd failed"
+ local realobdix=$($LFS getstripe -i $file)
+ local newmd5=$(md5sum $file)
+ [[ $newobdidx -ne $realobdix ]] &&
+ error "new OST is different (was=$obdidx, wanted=$newobdidx, got=$realobdix)"
+ [[ "$oldmd5" != "$newmd5" ]] &&
+ error "md5sum differ: $oldmd5, $newmd5"
+ fi
+
# lfs_migrate dir
cmd="$LFS_MIGRATE -y -c $expected $TDIR/dir1"
echo "$cmd"
/**
* Open a Lustre file.
*
- * \param name the name of the file to be opened
- * \param flags access mode, see flags in open(2)
- * \param mode permisson of the file if it is created, see mode in open(2)
- * \param param stripe pattern of the newly created file
+ * \param name the name of the file to be opened
+ * \param flags access mode, see flags in open(2)
+ * \param mode permission of the file if it is created, see mode in open(2)
+ * \param param stripe pattern of the newly created file
*
- * \return file descriptor of opened file
- * \return -error failure
+ * \retval file descriptor of opened file
+ * \retval negative errno on failure
*/
int llapi_file_open_param(const char *name, int flags, mode_t mode,
const struct llapi_stripe_param *param)
if (errno != EEXIST && errno != EALREADY)
errmsg = strerror(errno);
- llapi_err_noerrno(LLAPI_MSG_ERROR,
+ llapi_err_noerrno(LLAPI_MSG_ERROR,
"error on ioctl "LPX64" for '%s' (%d): %s",
(__u64)LL_IOC_LOV_SETSTRIPE, name, fd,
errmsg);
- }
- if (rc) {
close(fd);
fd = rc;
}
- if (lum != NULL)
- free(lum);
+
+ free(lum);
+
return fd;
}