return 0;
}
-static int mds_reconnect(struct obd_export *exp, struct obd_device *obd,
+static int mds_reconnect(const struct lu_env *env,
+ struct obd_export *exp, struct obd_device *obd,
struct obd_uuid *cluuid,
struct obd_connect_data *data)
{
*/
static int mds_connect(const struct lu_env *env,
struct lustre_handle *conn, struct obd_device *obd,
- struct obd_uuid *cluuid, struct obd_connect_data *data)
+ struct obd_uuid *cluuid, struct obd_connect_data *data,
+ void *localdata)
{
struct obd_export *exp;
struct mds_export_data *med;
LASSERT(exp);
med = &exp->exp_mds_data;
+ exp->exp_flvr.sf_rpc = SPTLRPC_FLVR_NULL;
+
rc = mds_connect_internal(exp, data);
if (rc)
GOTO(out, rc);
memcpy(mcd->mcd_uuid, cluuid, sizeof(mcd->mcd_uuid));
med->med_mcd = mcd;
- rc = mds_client_add(obd, exp, -1);
+ rc = mds_client_add(obd, exp, -1, localdata);
GOTO(out, rc);
out:
{
struct mds_export_data *med = &exp->exp_mds_data;
- INIT_LIST_HEAD(&med->med_open_head);
+ CFS_INIT_LIST_HEAD(&med->med_open_head);
spin_lock_init(&med->med_open_lock);
-
+
spin_lock(&exp->exp_lock);
exp->exp_connecting = 1;
spin_unlock(&exp->exp_lock);
}
static int mds_obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
- __u64 max_age)
+ __u64 max_age, __u32 flags)
{
int rc;
/* We call this so that we can cache a bit - 1 jiffie worth */
rc = mds_obd_statfs(obd, lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
size[REPLY_REC_OFF]),
- cfs_time_current_64() - HZ);
+ cfs_time_current_64() - HZ, 0);
if (rc) {
CERROR("mds_obd_statfs failed: rc %d\n", rc);
GOTO(out, rc);
if (rc)
GOTO(out, rc);
- if (body->fid1.id == 0) {
- /* a fid of zero is taken to mean "sync whole filesystem" */
- rc = fsfilt_sync(obd, obd->u.obt.obt_sb);
- GOTO(out, rc);
- } else {
+ rc = fsfilt_sync(obd, obd->u.obt.obt_sb);
+ if (rc == 0 && body->fid1.id != 0) {
struct dentry *de;
de = mds_fid2dentry(mds, &body->fid1, NULL);
if (IS_ERR(de))
GOTO(out, rc = PTR_ERR(de));
- /* The file parameter isn't used for anything */
- if (de->d_inode->i_fop && de->d_inode->i_fop->fsync)
- rc = de->d_inode->i_fop->fsync(NULL, de, 1);
- if (rc == 0) {
- body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
- sizeof(*body));
- mds_pack_inode2fid(&body->fid1, de->d_inode);
- mds_pack_inode2body(body, de->d_inode);
- }
+ body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
+ sizeof(*body));
+ mds_pack_inode2fid(&body->fid1, de->d_inode);
+ mds_pack_inode2body(body, de->d_inode);
l_dput(de);
- GOTO(out, rc);
}
+ GOTO(out, rc);
out:
req->rq_status = rc;
return 0;
__u32 *opcp = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF,
sizeof(*opcp));
__u32 opc;
+ int op = 0;
int size[4] = { sizeof(struct ptlrpc_body),
sizeof(struct mds_body),
mds->mds_max_mdsize,
(opc < sizeof(reint_names) / sizeof(reint_names[0]) ||
reint_names[opc] == NULL) ? reint_names[opc] :
"unknown opcode");
+ switch (opc) {
+ case REINT_CREATE:
+ op = PTLRPC_LAST_CNTR + MDS_REINT_CREATE;
+ break;
+ case REINT_LINK:
+ op = PTLRPC_LAST_CNTR + MDS_REINT_LINK;
+ break;
+ case REINT_OPEN:
+ op = PTLRPC_LAST_CNTR + MDS_REINT_OPEN;
+ break;
+ case REINT_SETATTR:
+ op = PTLRPC_LAST_CNTR + MDS_REINT_SETATTR;
+ break;
+ case REINT_RENAME:
+ op = PTLRPC_LAST_CNTR + MDS_REINT_RENAME;
+ break;
+ case REINT_UNLINK:
+ op = PTLRPC_LAST_CNTR + MDS_REINT_UNLINK;
+ break;
+ default:
+ op = 0;
+ break;
+ }
+
+ if (op && req->rq_rqbd->rqbd_service->srv_stats)
+ lprocfs_counter_incr(
+ req->rq_rqbd->rqbd_service->srv_stats, op);
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_NET))
RETURN(0);
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_CLOSE_NET))
RETURN(0);
rc = mds_close(req, REQ_REC_OFF);
+ fail = OBD_FAIL_MDS_CLOSE_NET_REP;
break;
case MDS_DONE_WRITING:
}
static int mds_lov_presetup (struct mds_obd *mds, struct lustre_cfg *lcfg)
{
- int rc;
+ int rc = 0;
ENTRY;
- rc = llog_start_commit_thread();
- if (rc < 0)
- RETURN(rc);
-
if (lcfg->lcfg_bufcount >= 4 && LUSTRE_CFG_BUFLEN(lcfg, 3) > 0) {
class_uuid_t uuid;
/* We mounted in lustre_fill_super.
lcfg bufs 1, 2, 4 (device, fstype, mount opts) are ignored.*/
-
+
lsi = s2lsi(lmi->lmi_sb);
fsoptions_to_mds_flags(mds, lsi->lsi_ldd->ldd_mount_opts);
fsoptions_to_mds_flags(mds, lsi->lsi_lmd->lmd_opts);
lprocfs_alloc_obd_stats(obd, LPROC_MDS_LAST) == 0) {
/* Init private stats here */
mds_stats_counter_init(obd->obd_stats);
- obd->obd_proc_exports = proc_mkdir("exports",
- obd->obd_proc_entry);
+ obd->obd_proc_exports_entry = lprocfs_register("exports",
+ obd->obd_proc_entry,
+ NULL, NULL);
+ if (IS_ERR(obd->obd_proc_exports_entry)) {
+ rc = PTR_ERR(obd->obd_proc_exports_entry);
+ CERROR("error %d setting up lprocfs for %s\n",
+ rc, "exports");
+ obd->obd_proc_exports_entry = NULL;
+ }
}
rc = mds_fs_setup(obd, mnt);
GOTO(err_ns, rc);
}
+ if (obd->obd_proc_exports_entry)
+ lprocfs_add_simple(obd->obd_proc_exports_entry,
+ "clear", lprocfs_nid_stats_clear_read,
+ lprocfs_nid_stats_clear_write, obd);
+
rc = mds_lov_presetup(mds, lcfg);
if (rc < 0)
GOTO(err_fs, rc);
mds->mds_group_hash = NULL;
#endif
err_ns:
- lprocfs_obd_cleanup(obd);
lprocfs_free_obd_stats(obd);
+ lprocfs_obd_cleanup(obd);
ldlm_namespace_free(obd->obd_namespace, 0);
obd->obd_namespace = NULL;
err_ops:
int rc = 0;
ENTRY;
- rc = llog_setup(obd, NULL, LLOG_CONFIG_ORIG_CTXT, obd, 0, NULL,
+ rc = llog_setup(obd, &obd->obd_olg, LLOG_CONFIG_ORIG_CTXT, obd, 0, NULL,
&llog_lvfs_ops);
if (rc)
RETURN(rc);
- rc = llog_setup(obd, NULL, LLOG_LOVEA_ORIG_CTXT, obd, 0, NULL,
+ rc = llog_setup(obd, &obd->obd_olg, LLOG_LOVEA_ORIG_CTXT, obd, 0, NULL,
&llog_lvfs_ops);
if (rc)
RETURN(rc);
RETURN(0);
LASSERT(!obd->obd_recovering);
- LASSERT(llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT) != NULL);
+ LASSERT(!llog_ctxt_null(obd, LLOG_MDS_OST_ORIG_CTXT));
+
/* clean PENDING dir */
if (strncmp(obd->obd_name, MDD_OBD_NAME, strlen(MDD_OBD_NAME)))
rc = mds_cleanup_pending(obd);
we just need to drop our ref */
class_export_put(mds->mds_osc_exp);
- lprocfs_obd_cleanup(obd);
+ lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
+ lprocfs_free_per_client_stats(obd);
lprocfs_free_obd_stats(obd);
+ lprocfs_obd_cleanup(obd);
lquota_cleanup(mds_quota_interface_ref, obd);
mds_max_threads = mds_min_threads = mds_num_threads;
} else {
/* Base min threads on memory and cpus */
- mds_min_threads = num_possible_cpus() * num_physpages >>
+ mds_min_threads = num_possible_cpus() * num_physpages >>
(27 - CFS_PAGE_SHIFT);
if (mds_min_threads < MDS_THREADS_MIN)
mds_min_threads = MDS_THREADS_MIN;
/* Largest auto threads start value */
- if (mds_min_threads > 32)
+ if (mds_min_threads > 32)
mds_min_threads = 32;
mds_max_threads = min(MDS_THREADS_MAX, mds_min_threads * 4);
}
MDS_MAXREPSIZE, MDS_REQUEST_PORTAL,
MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_TIMEOUT,
mds_handle, LUSTRE_MDS_NAME,
- obd->obd_proc_entry, NULL,
+ obd->obd_proc_entry, NULL,
mds_min_threads, mds_max_threads, "ll_mdt", 0);
if (!mds->mds_service) {
MDS_MAXREPSIZE, MDS_READPAGE_PORTAL,
MDC_REPLY_PORTAL, MDS_SERVICE_WATCHDOG_TIMEOUT,
mds_handle, "mds_readpage",
- obd->obd_proc_entry, NULL,
+ obd->obd_proc_entry, NULL,
MDS_THREADS_MIN_READPAGE, mds_max_threads,
"ll_mdt_rdpg", 0);
if (!mds->mds_readpage_service) {
GOTO(err_thread3, rc);
ping_evictor_start();
-
+
RETURN(0);
err_thread3: