struct obd_uuid *uuid;
LASSERT(watched);
-
+
if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) {
CERROR("unexpected notification of %s %s!\n",
watched->obd_type->typ_name,
* observer can use the OSC normally.
*/
rc = lov_set_osc_active(obd, uuid, ev == OBD_NOTIFY_ACTIVE);
- if (rc) {
+ if (rc < 0) {
CERROR("%sactivation of %s failed: %d\n",
(ev == OBD_NOTIFY_ACTIVE) ? "" : "de",
obd_uuid2str(uuid), rc);
RETURN(rc);
}
+ /* active event should be pass lov target index as data */
+ data = &rc;
}
/* Pass the notification up the chain. */
rc = obd_notify_observer(obd, watched, ev, data);
} else {
/* NULL watched means all osc's in the lov (only for syncs) */
+ /* sync event should be send lov idx as data */
struct lov_obd *lov = &obd->u.lov;
struct obd_device *tgt_obd;
int i;
if (!lov->lov_tgts[i])
continue;
tgt_obd = class_exp2obd(lov->lov_tgts[i]->ltd_exp);
+
+ if ((ev == OBD_NOTIFY_SYNC) ||
+ (ev == OBD_NOTIFY_SYNC_NONBLOCK))
+ data = &i;
+
rc = obd_notify_observer(obd, tgt_obd, ev, data);
if (rc) {
CERROR("%s: notify %s of %s failed %d\n",
* -EINVAL : UUID can't be found in the LOV's target list
* -ENOTCONN: The UUID is found, but the target connection is bad (!)
* -EBADF : The UUID is found, but the OBD is the wrong type (!)
+ * - any above 0 is lov index
*/
static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid,
int activate)
{
struct lov_obd *lov = &obd->u.lov;
struct lov_tgt_desc *tgt;
- int i, rc = 0;
+ int i = 0;
ENTRY;
CDEBUG(D_INFO, "Searching in lov %p for uuid %s (activate=%d)\n",
}
if (i == lov->desc.ld_tgt_count)
- GOTO(out, rc = -EINVAL);
+ GOTO(out, i = -EINVAL);
if (lov->lov_tgts[i]->ltd_active == activate) {
CDEBUG(D_INFO, "OSC %s already %sactive!\n", uuid->uuid,
activate ? "" : "in");
- GOTO(out, rc);
+ GOTO(out, i);
}
CDEBUG(D_CONFIG, "Marking OSC %s %sactive\n", obd_uuid2str(uuid),
out:
lov_putref(obd);
- RETURN(rc);
+ RETURN(i);
}
*desc_ret = lov->desc;
GOTO(out, rc = 0);
- } else if (KEY_IS(KEY_LOV_IDX)) {
- struct lov_tgt_desc *tgt;
-
- for(i = 0; i < lov->desc.ld_tgt_count; i++) {
- tgt = lov->lov_tgts[i];
- if (tgt && obd_uuid_equals(val, &tgt->ltd_uuid))
- GOTO(out, rc = i);
- }
} else if (KEY_IS(KEY_FIEMAP)) {
rc = lov_fiemap(lov, keylen, key, vallen, val, lsm);
GOTO(out, rc);
RETURN(rc);
}
-static __u32 mds_lov_get_idx(struct obd_export *lov,
- struct obd_uuid *ost_uuid)
-{
- int rc;
- int valsize = sizeof(ost_uuid);
-
- rc = obd_get_info(lov, sizeof(KEY_LOV_IDX), KEY_LOV_IDX,
- &valsize, ost_uuid, NULL);
- LASSERT(rc >= 0);
-
- RETURN(rc);
-}
-
/* Update the lov desc for a new size lov. */
static int mds_lov_update_desc(struct obd_device *obd, struct obd_export *lov,
__u32 index)
void *data, int nonblock)
{
struct mds_lov_sync_info *mlsi;
- struct mds_obd *mds = &obd->u.mds;
int rc;
struct obd_uuid *uuid;
ENTRY;
if (mlsi == NULL)
RETURN(-ENOMEM);
+ LASSERT(data);
mlsi->mlsi_obd = obd;
mlsi->mlsi_watched = watched;
- if (data)
- mlsi->mlsi_index = *(__u32 *)data;
- else
- mlsi->mlsi_index = mds_lov_get_idx(mds->mds_osc_exp, uuid);
+ mlsi->mlsi_index = *(__u32 *)data;
/* Although class_export_get(obd->obd_self_export) would lock
the MDS in place, since it's only a self-export
case OBD_NOTIFY_ACTIVE:
/* lov want one or more _active_ targets for work */
mds_allow_cli(obd, CONFIG_TARGET);
+ /* activate event should be pass lov idx as argument */
case OBD_NOTIFY_SYNC:
case OBD_NOTIFY_SYNC_NONBLOCK:
+ /* sync event should be pass lov idx as argument */
break;
case OBD_NOTIFY_CONFIG:
mds_allow_cli(obd, (unsigned long)data);
}
if (obd->obd_recovering) {
- __u32 idx;
CWARN("MDS %s: in recovery, not resetting orphans on %s\n",
obd->obd_name,
obd_uuid2str(&watched->u.cli.cl_target_uuid));
/* We still have to fix the lov descriptor for ost's added
after the mdt in the config log. They didn't make it into
mds_lov_connect. */
- idx = mds_lov_get_idx(obd->u.mds.mds_osc_exp,
- &watched->u.cli.cl_target_uuid);
- rc = mds_lov_update_desc(obd, obd->u.mds.mds_osc_exp, idx);
+ LASSERT(data);
+ rc = mds_lov_update_desc(obd, obd->u.mds.mds_osc_exp,
+ *(__u32 *)data);
mds_allow_cli(obd, CONFIG_SYNC);
RETURN(rc);
}