rc = osp_disconnect(d);
- osp_sync_fini(d);
-
if (!d->opd_connect_mdt) {
+ /* stop sync thread */
+ osp_sync_fini(d);
+
/* stop precreate thread */
osp_precreate_fini(d);
unsigned long start = cfs_time_current();
ENTRY;
+ /* No Sync between MDTs yet. */
+ if (d->opd_connect_mdt)
+ RETURN(0);
+
if (unlikely(d->opd_imp_active == 0))
RETURN(-ENOTCONN);
.dt_trans_create = osp_trans_create,
.dt_trans_start = osp_trans_start,
.dt_trans_stop = osp_trans_stop,
+ .dt_trans_cb_add = osp_trans_cb_add,
};
/**
}
/**
+ * Determine if the lock needs to be cancelled
+ *
+ * Determine if the unused lock should be cancelled before replay, see
+ * (ldlm_cancel_no_wait_policy()). Currently, only inode bits lock exists
+ * between MDTs.
+ *
+ * \param[in] lock lock to be checked.
+ *
+ * \retval 1 if the lock needs to be cancelled before replay.
+ * \retval 0 if the lock does not need to be cancelled before
+ * replay.
+ */
+static int osp_cancel_weight(struct ldlm_lock *lock)
+{
+ if (lock->l_resource->lr_type != LDLM_IBITS)
+ RETURN(0);
+
+ RETURN(1);
+}
+
+/**
* Initialize OSP device according to the parameters in the configuration
* log \a cfg.
*
rc = osp_init_precreate(osp);
if (rc)
GOTO(out_last_used, rc);
+
+ /*
+ * Initialize synhronization mechanism taking
+ * care of propogating changes to OST in near
+ * transactional manner.
+ */
+ rc = osp_sync_init(env, osp);
+ if (rc < 0)
+ GOTO(out_precreat, rc);
}
- /*
- * Initialize synhronization mechanism taking
- * care of propogating changes to OST in near
- * transactional manner.
- */
- rc = osp_sync_init(env, osp);
- if (rc)
- GOTO(out_precreat, rc);
+ ns_register_cancel(obd->obd_namespace, osp_cancel_weight);
/*
* Initiate connect to OST
RETURN(0);
out:
- /* stop sync thread */
- osp_sync_fini(osp);
+ if (!osp->opd_connect_mdt)
+ /* stop sync thread */
+ osp_sync_fini(osp);
out_precreat:
/* stop precreate thread */
if (!osp->opd_connect_mdt)
if (rc) {
CERROR("%s: can't connect obd: rc = %d\n", obd->obd_name, rc);
GOTO(out, rc);
+ } else {
+ osp->opd_obd->u.cli.cl_seq->lcs_exp =
+ class_export_get(osp->opd_exp);
}
ptlrpc_pinger_add_import(imp);
}
/**
- * Prepare fid client.
- *
- * This function prepares the FID client for the OSP. It will check and assign
- * the export (to MDT0) for its FID client, so OSP can allocate super sequence
- * or lookup sequence in FLDB of MDT0.
- *
- * \param[in] osp OSP device
- */
-static void osp_prepare_fid_client(struct osp_device *osp)
-{
- LASSERT(osp->opd_obd->u.cli.cl_seq != NULL);
- if (osp->opd_obd->u.cli.cl_seq->lcs_exp != NULL)
- return;
-
- LASSERT(osp->opd_exp != NULL);
- osp->opd_obd->u.cli.cl_seq->lcs_exp =
- class_export_get(osp->opd_exp);
-}
-
-/**
* Implementation of obd_ops::o_import_event
*
* This function is called when some related import event happens. It will
case IMP_EVENT_ACTIVE:
d->opd_imp_active = 1;
- osp_prepare_fid_client(d);
if (d->opd_got_disconnected)
d->opd_new_connection = 1;
d->opd_imp_connected = 1;
* \param[in] key the key
* \param[out] vallen length of \a val
* \param[out] val holds the value returned by the key
- * \param[in] unused necessary for the interface but unused
*
* \retval 0 0 if getting information succeeded.
* \retval negative negative errno if getting information failed.
*/
static int osp_obd_get_info(const struct lu_env *env, struct obd_export *exp,
- __u32 keylen, void *key, __u32 *vallen, void *val,
- struct lov_stripe_md *unused)
+ __u32 keylen, void *key, __u32 *vallen, void *val)
{
int rc = -EINVAL;
LASSERT(osp->opd_obd->u.cli.cl_seq != NULL);
/* Sigh, fid client is not ready yet */
- if (osp->opd_obd->u.cli.cl_seq->lcs_exp == NULL)
- RETURN(-ENOTCONN);
+ LASSERT(osp->opd_obd->u.cli.cl_seq->lcs_exp != NULL);
RETURN(seq_client_alloc_fid(env, seq, fid));
}
MODULE_AUTHOR("Intel, Inc. <http://www.intel.com/>");
MODULE_DESCRIPTION("Lustre OST Proxy Device ("LUSTRE_OSP_NAME")");
+MODULE_VERSION(LUSTRE_VERSION_STRING);
MODULE_LICENSE("GPL");
-cfs_module(osp, LUSTRE_VERSION_STRING, osp_mod_init, osp_mod_exit);
+module_init(osp_mod_init);
+module_exit(osp_mod_exit);