param->fp_xxx_index is the number of the specified targets, not
the specific index, so it can't be passed into llapi_obd_statfs()
directly to get the statfs information. Instead, all the targets
listed in param->fp_xxx_indexes should be passed one by one.
Also, $mdt_idx in sanity.sh test_56rb should be initialized with
the correct mdt index.
Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: Idffdddac1b5b249aa903b97912c767826f3b146c
Reviewed-on: https://review.whamcloud.com/38959
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
test_mkdir -p $dir || error "failed to mkdir $dir"
$LFS setstripe -c 1 -i 0 $dir/$tfile ||
error "failed to setstripe $dir/$tfile"
test_mkdir -p $dir || error "failed to mkdir $dir"
$LFS setstripe -c 1 -i 0 $dir/$tfile ||
error "failed to setstripe $dir/$tfile"
+ mdt_idx=$($LFS getdirstripe -i $dir)
dd if=/dev/zero of=$dir/$tfile bs=1M count=1
stack_trap "rm -f $tmp" EXIT
dd if=/dev/zero of=$dir/$tfile bs=1M count=1
stack_trap "rm -f $tmp" EXIT
- $LFS find --size +100K --ost 0 $dir 2>&1 | tee $tmp
- [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ $LFS find --size +100K --ost 0 $dir |& tee $tmp
+ ! grep -q obd_uuid $tmp ||
error "failed to find --size +100K --ost 0 $dir"
error "failed to find --size +100K --ost 0 $dir"
- $LFS find --size +100K --mdt $mdt_idx $dir 2>&1 | tee $tmp
- [ -z "$(cat $tmp | grep "obd_uuid: ")" ] ||
+ $LFS find --size +100K --mdt $mdt_idx $dir |& tee $tmp
+ ! grep -q obd_uuid $tmp ||
error "failed to find --size +100K --mdt $mdt_idx $dir"
}
run_test 56rb "check lfs find --size --ost/--mdt works"
error "failed to find --size +100K --mdt $mdt_idx $dir"
}
run_test 56rb "check lfs find --size --ost/--mdt works"
- * the llapi_obd_statfs() call may have returned with
+ * the llapi_obd_fstatfs() call may have returned with
* an error, but if it filled in uuid_buf we will at
* lease use that to print out a message for that OBD.
* If we didn't get anything in the uuid_buf, then fill
* an error, but if it filled in uuid_buf we will at
* lease use that to print out a message for that OBD.
* If we didn't get anything in the uuid_buf, then fill
* not active, just print the object affected by this
* failed target
**/
* not active, just print the object affected by this
* failed target
**/
-static int print_failed_tgt(struct find_param *param, char *path, int type)
+static void print_failed_tgt(struct find_param *param, char *path, int type)
{
struct obd_statfs stat_buf;
struct obd_uuid uuid_buf;
{
struct obd_statfs stat_buf;
struct obd_uuid uuid_buf;
+ int tgt_nr, i, *indexes;
+ int ret = 0;
- if (type != LL_STATFS_LOV && type != LL_STATFS_LMV)
- return -EINVAL;
+ if (type != LL_STATFS_LOV && type != LL_STATFS_LMV) {
+ llapi_error(LLAPI_MSG_NORMAL, ret, "%s: wrong statfs type(%d)",
+ __func__, type);
+ return;
+ }
- memset(&stat_buf, 0, sizeof(struct obd_statfs));
- memset(&uuid_buf, 0, sizeof(struct obd_uuid));
- ret = llapi_obd_statfs(path, type,
- type == LL_STATFS_LOV ? param->fp_obd_index :
- param->fp_mdt_index, &stat_buf,
- &uuid_buf);
- if (ret)
- llapi_error(LLAPI_MSG_NORMAL, ret, "obd_uuid: %s failed",
- param->fp_obd_uuid->uuid);
+ tgt_nr = (type == LL_STATFS_LOV) ? param->fp_obd_index :
+ param->fp_mdt_index;
+ indexes = (type == LL_STATFS_LOV) ? param->fp_obd_indexes :
+ param->fp_mdt_indexes;
+ for (i = 0; i < tgt_nr; i++) {
+ memset(&stat_buf, 0, sizeof(struct obd_statfs));
+ memset(&uuid_buf, 0, sizeof(struct obd_uuid));
+
+ ret = llapi_obd_statfs(path, type, indexes[i], &stat_buf,
+ &uuid_buf);
+ if (ret)
+ llapi_error(LLAPI_MSG_NORMAL, ret,
+ "%s: obd_uuid: %s failed",
+ __func__, param->fp_obd_uuid->uuid);
+ }
}
static int find_check_stripe_size(struct find_param *param)
}
static int find_check_stripe_size(struct find_param *param)
ret = llapi_ioctl_pack(&data, &rawbuf, sizeof(raw));
if (ret != 0) {
llapi_error(LLAPI_MSG_ERROR, ret,
ret = llapi_ioctl_pack(&data, &rawbuf, sizeof(raw));
if (ret != 0) {
llapi_error(LLAPI_MSG_ERROR, ret,
- "llapi_obd_statfs: error packing ioctl data");
+ "%s: error packing ioctl data", __func__);
rc = llapi_ioctl_pack(&data, &rawbuf, sizeof(raw));
if (rc != 0) {
llapi_error(LLAPI_MSG_ERROR, rc,
rc = llapi_ioctl_pack(&data, &rawbuf, sizeof(raw));
if (rc != 0) {
llapi_error(LLAPI_MSG_ERROR, rc,
- "llapi_obd_statfs: error packing ioctl data");
+ "%s: error packing ioctl data", __func__);