+ lov_uuid2str(lov, index), index,
+ obd_uuid2str(uuidp));
+ GOTO(out, rc = -EINVAL);
+ }
+
+ CDEBUG(D_CONFIG, "uuid: %s idx: %d gen: %d exp: %p active: %d\n",
+ lov_uuid2str(lov, index), index,
+ lov->lov_tgts[index]->ltd_gen, lov->lov_tgts[index]->ltd_exp,
+ lov->lov_tgts[index]->ltd_active);
+
+ lov->lov_tgts[index]->ltd_reap = 1;
+ lov->lov_death_row++;
+ /* we really delete it from lov_putref */
+out:
+ lov_putref(obd);
+
+ RETURN(rc);
+}
+
+/* We are holding lov_lock */
+static void __lov_del_obd(struct obd_device *obd, __u32 index)
+{
+ struct lov_obd *lov = &obd->u.lov;
+ struct obd_device *osc_obd;
+ struct lov_tgt_desc *tgt = lov->lov_tgts[index];
+
+ LASSERT(tgt);
+ LASSERT(tgt->ltd_reap);
+
+ osc_obd = class_exp2obd(tgt->ltd_exp);
+
+ CDEBUG(D_CONFIG, "Removing tgt %s : %s\n",
+ lov_uuid2str(lov, index),
+ osc_obd ? osc_obd->obd_name : "<no obd>");
+
+ if (tgt->ltd_exp)
+ lov_disconnect_obd(obd, index);
+
+ /* XXX - right now there is a dependency on ld_tgt_count being the
+ * maximum tgt index for computing the mds_max_easize. So we can't
+ * shrink it. */
+
+ lov->lov_tgts[index] = NULL;
+ OBD_FREE_PTR(tgt);
+
+ /* Manual cleanup - no cleanup logs to clean up the osc's. We must
+ do it ourselves. And we can't do it from lov_cleanup,
+ because we just lost our only reference to it. */
+ if (osc_obd)
+ class_manual_cleanup(osc_obd);
+}
+
+void lov_fix_desc(struct lov_desc *desc)
+{
+ if (desc->ld_default_stripe_size < PTLRPC_MAX_BRW_SIZE) {
+ LCONSOLE_WARN("Increasing default stripe size to min %u\n",
+ PTLRPC_MAX_BRW_SIZE);
+ desc->ld_default_stripe_size = PTLRPC_MAX_BRW_SIZE;
+ } else if (desc->ld_default_stripe_size & (LOV_MIN_STRIPE_SIZE - 1)) {
+ desc->ld_default_stripe_size &= ~(LOV_MIN_STRIPE_SIZE - 1);
+ LCONSOLE_WARN("Changing default stripe size to "LPU64" (a "
+ "multiple of %u)\n",
+ desc->ld_default_stripe_size,LOV_MIN_STRIPE_SIZE);
+ }
+
+ if (desc->ld_default_stripe_count == 0)
+ desc->ld_default_stripe_count = 1;
+
+ /* from lov_setstripe */
+ if ((desc->ld_pattern != 0) &&
+ (desc->ld_pattern != LOV_PATTERN_RAID0)) {
+ LCONSOLE_WARN("Unknown stripe pattern: %#x\n",desc->ld_pattern);
+ desc->ld_pattern = 0;
+ }
+
+ if (desc->ld_qos_maxage == 0)
+ desc->ld_qos_maxage = QOS_DEFAULT_MAXAGE;
+}
+
+static int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
+{
+ struct lprocfs_static_vars lvars;
+ struct lov_desc *desc;
+ struct lov_obd *lov = &obd->u.lov;
+ int count;
+ ENTRY;
+
+ if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
+ CERROR("LOV setup requires a descriptor\n");