/*
* Initialized in mdt_mod_init().
*/
-unsigned long mdt_num_threads;
+static unsigned long mdt_num_threads;
+static unsigned long mdt_min_threads;
+static unsigned long mdt_max_threads;
/* ptlrpc request handler for MDT. All handlers are
* grouped into several slices - struct mdt_opc_slice,
static int mdt_recovery(struct mdt_thread_info *info)
{
struct ptlrpc_request *req = mdt_info_req(info);
- int recovering;
struct obd_device *obd;
ENTRY;
obd = req->rq_export->exp_obd;
/* Check for aborted recovery... */
- cfs_spin_lock_bh(&obd->obd_processing_task_lock);
- recovering = obd->obd_recovering;
- cfs_spin_unlock_bh(&obd->obd_processing_task_lock);
- if (unlikely(recovering)) {
+ if (unlikely(obd->obd_recovering)) {
int rc;
int should_process;
DEBUG_REQ(D_INFO, req, "Got new replay");
switch (lustre_msg_get_opc(msg)) {
case MDS_CONNECT:
case MDS_DISCONNECT:
- case MDS_SET_INFO:
case OBD_PING:
case SEC_CTX_INIT:
case SEC_CTX_INIT_CONT:
case MDS_SYNC:
case MDS_GETXATTR:
case MDS_SETXATTR:
+ case MDS_SET_INFO:
case MDS_GET_INFO:
case MDS_QUOTACHECK:
case MDS_QUOTACTL:
* We'd like to have a mechanism to set this on a per-device
* basis, but alas...
*/
- .psc_min_threads = min(max(mdt_num_threads, MDT_MIN_THREADS),
- MDT_MAX_THREADS),
- .psc_max_threads = MDT_MAX_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD
};
.psc_req_portal = MDS_READPAGE_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = min(max(mdt_num_threads, MDT_MIN_THREADS),
- MDT_MAX_THREADS),
- .psc_max_threads = MDT_MAX_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD
};
m->mdt_readpage_service =
.psc_req_portal = MDS_SETATTR_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = min(max(mdt_num_threads, MDT_MIN_THREADS),
- MDT_MAX_THREADS),
- .psc_max_threads = MDT_MAX_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD
};
.psc_req_portal = SEQ_CONTROLLER_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = SEQ_NUM_THREADS,
- .psc_max_threads = SEQ_NUM_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD
};
.psc_req_portal = SEQ_METADATA_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = SEQ_NUM_THREADS,
- .psc_max_threads = SEQ_NUM_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD
};
.psc_req_portal = SEQ_DATA_PORTAL,
.psc_rep_portal = OSC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = SEQ_NUM_THREADS,
- .psc_max_threads = SEQ_NUM_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD|LCT_DT_THREAD
};
.psc_req_portal = FLD_REQUEST_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = FLD_NUM_THREADS,
- .psc_max_threads = FLD_NUM_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_DT_THREAD|LCT_MD_THREAD
};
.psc_req_portal = MDS_MDS_PORTAL,
.psc_rep_portal = MDC_REPLY_PORTAL,
.psc_watchdog_factor = MDT_SERVICE_WATCHDOG_FACTOR,
- .psc_min_threads = min(max(mdt_num_threads, MDT_MIN_THREADS),
- MDT_MAX_THREADS),
- .psc_max_threads = MDT_MAX_THREADS,
+ .psc_min_threads = mdt_min_threads,
+ .psc_max_threads = mdt_max_threads,
.psc_ctx_tags = LCT_MD_THREAD
};
m->mdt_xmds_service =
obd = class_name2obd(dev);
LASSERT(obd != NULL);
- cfs_spin_lock_init(&m->mdt_transno_lock);
-
m->mdt_max_mdsize = MAX_MD_SIZE;
m->mdt_max_cookiesize = sizeof(struct llog_cookie);
m->mdt_som_conf = 0;
m->mdt_nosquash_strlen = 0;
cfs_init_rwsem(&m->mdt_squash_sem);
- cfs_spin_lock_init(&m->mdt_client_bitmap_lock);
-
OBD_ALLOC_PTR(mite);
if (mite == NULL)
GOTO(err_lmi, rc = -ENOMEM);
memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid);
lexp->exp_mdt_data.med_lcd = lcd;
rc = mdt_client_new(env, mdt);
- if (rc != 0) {
- OBD_FREE_PTR(lcd);
- lexp->exp_mdt_data.med_lcd = NULL;
- } else {
+ if (rc == 0)
mdt_export_stats_init(obd, lexp, localdata);
- }
- } else
+ } else {
rc = -ENOMEM;
+ }
}
out:
if (obd_uuid_equals(&exp->exp_client_uuid, &exp->exp_obd->obd_uuid))
RETURN(0);
+ lut_client_free(exp);
RETURN(rc);
}
static void mdt_allow_cli(struct mdt_device *m, unsigned int flag)
{
if (flag & CONFIG_LOG)
- m->mdt_fl_cfglog = 1;
+ cfs_set_bit(MDT_FL_CFGLOG, &m->mdt_state);
/* also notify active event */
if (flag & CONFIG_SYNC)
- m->mdt_fl_synced = 1;
+ cfs_set_bit(MDT_FL_SYNCED, &m->mdt_state);
- if (m->mdt_fl_cfglog && m->mdt_fl_synced)
+ if (cfs_test_bit(MDT_FL_CFGLOG, &m->mdt_state) &&
+ cfs_test_bit(MDT_FL_SYNCED, &m->mdt_state)) {
+ struct obd_device *obd = m->mdt_md_dev.md_lu_dev.ld_obd;
+
/* Open for clients */
- m->mdt_md_dev.md_lu_dev.ld_obd->obd_no_conn = 0;
+ if (obd->obd_no_conn) {
+ cfs_spin_lock_bh(&obd->obd_processing_task_lock);
+ obd->obd_no_conn = 0;
+ cfs_spin_unlock_bh(&obd->obd_processing_task_lock);
+ }
+ }
}
static int mdt_upcall(const struct lu_env *env, struct md_device *md,
break;
case MD_LOV_CONFIG:
/* Check that MDT is not yet configured */
- LASSERT(!m->mdt_fl_cfglog);
+ LASSERT(!cfs_test_bit(MDT_FL_CFGLOG, &m->mdt_state));
break;
#ifdef HAVE_QUOTA_SUPPORT
case MD_LOV_QUOTA:
*/
int mdt_hsm_copytool_send(struct obd_export *exp)
{
- struct lnl_hdr *lh;
+ struct kuc_hdr *lh;
struct hsm_action_list *hal;
struct hsm_action_item *hai;
int rc, len;
if (lh == NULL)
RETURN(-ENOMEM);
- lh->lnl_magic = LNL_MAGIC;
- lh->lnl_transport = LNL_TRANSPORT_HSM;
- lh->lnl_msgtype = HMT_ACTION_LIST;
- lh->lnl_msglen = len;
+ lh->kuc_magic = KUC_MAGIC;
+ lh->kuc_transport = KUC_TRANSPORT_HSM;
+ lh->kuc_msgtype = HMT_ACTION_LIST;
+ lh->kuc_msglen = len;
hal = (struct hsm_action_list *)(lh + 1);
hal->hal_version = HAL_VERSION;
/* Uses the ldlm reverse import; this rpc will be seen by
the ldlm_callback_handler */
- rc = target_set_info_rpc(exp->exp_imp_reverse, LDLM_SET_INFO,
- sizeof(KEY_HSM_COPYTOOL_SEND),
- KEY_HSM_COPYTOOL_SEND,
- len, lh, NULL);
+ rc = do_set_info_async(exp->exp_imp_reverse,
+ LDLM_SET_INFO, LUSTRE_OBD_VERSION,
+ sizeof(KEY_HSM_COPYTOOL_SEND),
+ KEY_HSM_COPYTOOL_SEND,
+ len, lh, NULL);
OBD_FREE(lh, len);
llo_local_obj_register(&mdt_last_recv);
- mdt_num_threads = MDT_NUM_THREADS;
+ if (mdt_num_threads > 0) {
+ if (mdt_num_threads > MDT_MAX_THREADS)
+ mdt_num_threads = MDT_MAX_THREADS;
+ if (mdt_num_threads < MDT_MIN_THREADS)
+ mdt_num_threads = MDT_MIN_THREADS;
+ mdt_max_threads = mdt_min_threads = mdt_num_threads;
+ } else {
+ mdt_max_threads = MDT_MAX_THREADS;
+ mdt_min_threads = MDT_MIN_THREADS;
+ if (mdt_min_threads < MDT_NUM_THREADS)
+ mdt_min_threads = MDT_NUM_THREADS;
+ }
+
lprocfs_mdt_init_vars(&lvars);
rc = class_register_type(&mdt_obd_device_ops, NULL,
lvars.module_vars, LUSTRE_MDT_NAME,