Running "lfs getstripe -c" on a composite file returns the stripe
count of the last initialized component, but "lfs find -c N" does
not find this file because it was adding the total stripe_count
of all components. "lfs find" should also check the stripe_count
of the last initialized component, as described in the man page.
Also use the last component stripe_size instead of any component.
Add a test case for the correct usage.
Fixes:
5a76aee24476 ("LU-8998 lfs: user space tools for PFL")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I1f0097aa002b29febcbf183cab02519b202540e5
Reviewed-on: https://review.whamcloud.com/35611
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Stephan Thiell <sthiell@stanford.edu>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Stripe size is \fIn\fR bytes, or \fBK\fRibi-, \fBM\fRebi-,
\fBG\fRibi-, \fBT\fRebi-, \fBP\fRebi-, or \fBE\fRbi-abytes if a
suffix is given. For composite files, this matches the stripe
-size of any non-extension component.
+size of the last initialized non-extension component.
.TP
.BR --extension-size | --ext-size | -z
Extension size is \fIn\fR bytes, or \fBK\fRibi-, \fBM\fRebi-,
$LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
$LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
test_mkdir $parent/subdir
- $LFS setstripe -E 6M -S 1M -E 30M -E eof $parent/subdir ||
+ $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c -1 $parent/subdir ||
error "setstripe to subdir"
$LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
$LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
[ $found -eq 2 ] ||
error "start-1M, end+5M, !count+2, flag=init, $found != 2"
+
+ # check last component stripe count
+ if [ $OSTCOUNT -gt 1 ]; then
+ touch $parent/subdir/f5
+ $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
+ found=$($LFS find $parent/subdir -c $OSTCOUNT)
+ [[ "$found" == "$parent/subdir/f5" ]] ||
+ error "got '$found' with stripe_count=$OSTCOUNT, not f5"
+ fi
}
run_test 15 "Verify component options for lfs find"
{
struct lov_comp_md_v1 *comp_v1 = NULL;
struct lov_user_md_v1 *v1 = ¶m->fp_lmd->lmd_lmm;
+ __u32 stripe_size = 0;
int ret, i, count = 1;
if (v1->lmm_magic == LOV_USER_MAGIC_FOREIGN)
ent = &comp_v1->lcm_entries[i];
if (ent->lcme_flags & LCME_FL_EXTENSION)
continue;
+ if (!(ent->lcme_flags & LCME_FL_INIT))
+ continue;
}
-
- ret = find_value_cmp(v1->lmm_stripe_size, param->fp_stripe_size,
- param->fp_stripe_size_sign,
- param->fp_exclude_stripe_size,
- param->fp_stripe_size_units, 0);
- /* If any stripe_size matches */
- if (ret != -1)
- break;
+ stripe_size = v1->lmm_stripe_size;
}
+ ret = find_value_cmp(stripe_size, param->fp_stripe_size,
+ param->fp_stripe_size_sign,
+ param->fp_exclude_stripe_size,
+ param->fp_stripe_size_units, 0);
+
return ret;
}
v1 = lov_comp_entry(comp_v1, i);
ent = &comp_v1->lcm_entries[i];
+ if (!(ent->lcme_flags & LCME_FL_INIT))
+ continue;
+
if (ent->lcme_flags & LCME_FL_EXTENSION)
continue;
}
- stripe_count += v1->lmm_stripe_count;
+ stripe_count = v1->lmm_stripe_count;
}
return stripe_count;