lod_comp = &lo->ldo_comp_entries[0];
for (i = 0; i < lo->ldo_comp_cnt; i++, lod_comp++) {
- int stale = !!(lod_comp->llc_flags & LCME_FL_STALE);
- int preferred = !!(lod_comp->llc_flags & LCME_FL_PREF_WR);
+ bool stale = lod_comp->llc_flags & LCME_FL_STALE;
+ bool preferred = lod_comp->llc_flags & LCME_FL_PREF_WR;
+ bool init = lod_comp_inited(lod_comp);
int j;
pref = 0;
/* calculate component preference over all used OSTs */
- for (j = 0; j < lod_comp->llc_stripes_allocated; j++) {
- int idx = lod_comp->llc_ost_indices[j];
- struct obd_statfs *osfs = &OST_TGT(lod,idx)->ltd_statfs;
+ for (j = 0; init && j < lod_comp->llc_stripes_allocated; j++) {
+ __u32 idx = lod_comp->llc_ost_indices[j];
+ struct lod_tgt_desc *ltd;
- if (osfs->os_state & OS_STATFS_NONROT)
+ if (unlikely(idx > lod->lod_ost_descs.ltd_tgts_size)) {
+ CERROR("%s: "DFID" OST idx %u > max %u\n",
+ lod2obd(lod)->obd_name,
+ PFID(lu_object_fid(&lo->ldo_obj.do_lu)),
+ idx, lod->lod_ost_descs.ltd_tgts_size);
+ continue;
+ }
+ ltd = OST_TGT(lod, idx);
+ if (unlikely(!ltd)) {
+ CERROR("%s: "DFID" OST idx %u is NULL\n",
+ lod2obd(lod)->obd_name,
+ PFID(lu_object_fid(&lo->ldo_obj.do_lu)),
+ idx);
+ continue;
+ }
+
+ if (ltd->ltd_statfs.os_state & OS_STATFS_NONROT)
pref++;
}
* Instantiate objects for stripes.
*
* Allocate and initialize LU-objects representing the stripes. The number
- * of the stripes (ldo_stripe_count) must be initialized already. The caller
+ * of the stripes (llc_stripe_count) must be initialized already. The caller
* must ensure nobody else is calling the function on the object at the same
* time. FLDB service must be running to be able to map a FID to the targets
* and find appropriate device representing that target.
run_test 32g "flr/dom upgrade test"
test_33a() { # bug 12333, was test_33
- local FSNAME2=test-123
+ local FSNAME2=test-$testnum
local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
local mkfsoptions
echo ok
$LFS osts
+ # test instantiating PFL components with sparse index LU-15513
+ mkdir -p $MOUNT/$tdir
+ $LFS setstripe -E 4M -c 1 -E 1G -c 4 -S4M -E eof -c -1 $MOUNT/$tdir
+ dd if=/dev/zero of=$MOUNT/$tdir/$tfile bs=4K count=1 seek=10k ||
+ error "dd to second component failed"
+
if [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
[[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
"$MDS1_VERSION" -lt $(version_code 2.5.11) ]]; then