/*sync the md layer*/
MD_LOV_SYNC = (1 << 0),
MD_NO_TRANS = (1 << 1), /* Just for split, no need trans, for replay */
+ MD_LOV_CONFIG = (1 << 2)
};
struct md_upcall {
OBD_NOTIFY_CONFIG
};
+/* bit-mask flags for config events */
+enum config_flags {
+ CONFIG_LOG = 0x1, /* finished processing config log */
+ CONFIG_SYNC = 0x2 /* mdt synced 1 ost */
+};
+
/*
* Data structure used to pass obd_notify()-event to non-obd listeners (llite
* and liblustre being main examples).
#include "mdd_internal.h"
-static int mdd_lov_update(struct obd_device *host,
- struct obd_device *watched,
- enum obd_notify_event ev, void *owner)
+static int mdd_notify(struct obd_device *host, struct obd_device *watched,
+ enum obd_notify_event ev, void *owner)
{
struct mdd_device *mdd = owner;
int rc = 0;
ENTRY;
LASSERT(owner != NULL);
-
- rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_SYNC);
+ switch (ev)
+ {
+ case OBD_NOTIFY_ACTIVE:
+ case OBD_NOTIFY_SYNC:
+ case OBD_NOTIFY_SYNC_NONBLOCK:
+ rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_SYNC);
+ break;
+ case OBD_NOTIFY_CONFIG:
+ rc = md_do_upcall(NULL, &mdd->mdd_md_dev, MD_LOV_CONFIG);
+ break;
+ default:
+ CDEBUG(D_INFO, "Unhandled notification %#x\n", ev);
+ }
RETURN(rc);
}
* Add here for obd notify mechanism, when adding a new ost, the mds
* will notify this mdd.
*/
- obd->obd_upcall.onu_upcall = mdd_lov_update;
+ obd->obd_upcall.onu_upcall = mdd_notify;
obd->obd_upcall.onu_owner = mdd;
mdd->mdd_obd_dev = obd;
return rc;
}
+static void mdt_allow_cli(struct mdt_device *m, unsigned int flag)
+{
+ if (flag & CONFIG_LOG)
+ m->mdt_fl_cfglog = 1;
+ if (flag & CONFIG_SYNC)
+ m->mdt_fl_synced = 1;
+
+ if (m->mdt_fl_cfglog && m->mdt_fl_synced)
+ /* Open for clients */
+ m->mdt_md_dev.md_lu_dev.ld_obd->obd_no_conn = 0;
+}
+
static int mdt_upcall(const struct lu_env *env, struct md_device *md,
enum md_upcall_event ev)
{
&m->mdt_max_cookiesize);
CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n",
m->mdt_max_mdsize, m->mdt_max_cookiesize);
+ mdt_allow_cli(m, CONFIG_SYNC);
break;
case MD_NO_TRANS:
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
mti->mti_no_need_trans = 1;
CDEBUG(D_INFO, "disable mdt trans for this thread\n");
break;
+ case MD_LOV_CONFIG:
+ /* Check that MDT is not yet configured */
+ LASSERT(!m->mdt_fl_cfglog);
+ break;
default:
CERROR("invalid event\n");
rc = -EINVAL;
static int mdt_obd_notify(struct obd_device *host,
struct obd_device *watched,
- enum obd_notify_event ev, void *owner)
+ enum obd_notify_event ev, void *data)
{
ENTRY;
switch (ev) {
case OBD_NOTIFY_CONFIG:
- host->obd_no_conn = 0;
+ mdt_allow_cli(mdt_dev(host->obd_lu_dev), (unsigned int)data);
+ break;
default:
- CDEBUG(D_INFO, "Notification 0x%x\n", ev);
+ CDEBUG(D_INFO, "Unhandled notification %#x\n", ev);
}
RETURN(0);
}
mo_mds_capa :1,
mo_oss_capa :1;
} mdt_opts;
-
+ /* mdt state flags */
+ __u32 mdt_fl_cfglog:1,
+ mdt_fl_synced:1;
/* lock to pretect epoch and write count */
spinlock_t mdt_ioepoch_lock;
__u64 mdt_ioepoch;
}
/* log has been fully processed */
- obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, 0);
+ obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, (void *)CONFIG_LOG);
}
RETURN(rc);