}
run_test 204f "FLR write/stale/resync sel w/forced extension"
+function test_205() {
+ local tf=$DIR/$tfile
+ local mirrors
+
+ $LFS setstripe -c1 $tf
+ $LFS mirror extend -N $tf
+ mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l )
+ (( $mirrors == 2 )) || error "no new mirror was created?"
+
+ $LFS mirror extend -N --flags=prefer $tf
+ mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l )
+ (( $mirrors == 3 )) || error "no new mirror was created?"
+
+ $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q prefer) ||
+ error "prefer flag was not set on the new mirror"
+}
+run_test 205 "lfs mirror extend to set prefer flag"
+
complete $SECONDS
check_and_cleanup_lustre
exit_status
}
static int mirror_extend_layout(char *name, struct llapi_layout *m_layout,
- bool inherit)
+ bool inherit, uint32_t flags)
{
struct llapi_layout *f_layout = NULL;
struct ll_ioc_lease *data = NULL;
goto out;
}
}
+ llapi_layout_comp_flags_set(m_layout, flags);
rc = migrate_open_files(name, 0, NULL, m_layout, &fd, &fdv);
if (rc < 0)
goto out;
while (mirror_count > 0) {
rc = mirror_extend_layout(fname,
mirror_list->m_layout,
- mirror_list->m_inherit);
+ mirror_list->m_inherit,
+ mirror_list->m_flags);
if (rc)
break;
if (comp->llc_flags & ~LCME_USER_COMP_FLAGS)
args->lsa_rc = LSE_FLAGS;
} else {
- if (comp->llc_flags & ~LCME_FL_EXTENSION)
+ if (comp->llc_flags &
+ ~(LCME_FL_EXTENSION | LCME_FL_PREF_RW))
args->lsa_rc = LSE_FLAGS;
}
}