* Initialized in mdt_mod_init().
*/
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_statfs(struct mdt_thread_info *info)
{
- struct ptlrpc_request *req = mdt_info_req(info);
- struct md_device *next = info->mti_mdt->mdt_child;
- struct ptlrpc_service *svc;
- struct obd_statfs *osfs;
- int rc;
+ struct ptlrpc_request *req = mdt_info_req(info);
+ struct md_device *next = info->mti_mdt->mdt_child;
+ struct ptlrpc_service_part *svcpt;
+ struct obd_statfs *osfs;
+ int rc;
- ENTRY;
+ ENTRY;
- svc = info->mti_pill->rc_req->rq_rqbd->rqbd_service;
+ svcpt = info->mti_pill->rc_req->rq_rqbd->rqbd_svcpt;
- /* This will trigger a watchdog timeout */
- OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_STATFS_LCW_SLEEP,
- (MDT_SERVICE_WATCHDOG_FACTOR *
- at_get(&svc->srv_at_estimate)) + 1);
+ /* This will trigger a watchdog timeout */
+ OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_STATFS_LCW_SLEEP,
+ (MDT_SERVICE_WATCHDOG_FACTOR *
+ at_get(&svcpt->scp_at_estimate)) + 1);
rc = mdt_check_ucred(info);
if (rc)
CERROR("readlink failed: %d\n", rc);
rc = -EFAULT;
} else {
- if (OBD_FAIL_CHECK(OBD_FAIL_MDS_READLINK_EPROTO))
- rc -= 2;
- repbody->valid |= OBD_MD_LINKNAME;
- /* we need to report back size with NULL-terminator
- * because client expects that */
- repbody->eadatasize = rc + 1;
- if (repbody->eadatasize != reqbody->eadatasize)
- CERROR("Read shorter link %d than expected "
- "%d\n", rc, reqbody->eadatasize - 1);
- /* NULL terminate */
- ((char*)ma->ma_lmm)[rc] = 0;
- CDEBUG(D_INODE, "symlink dest %s, len = %d\n",
- (char*)ma->ma_lmm, rc);
- rc = 0;
+ int print_limit = min_t(int, CFS_PAGE_SIZE - 128, rc);
+
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDS_READLINK_EPROTO))
+ rc -= 2;
+ repbody->valid |= OBD_MD_LINKNAME;
+ /* we need to report back size with NULL-terminator
+ * because client expects that */
+ repbody->eadatasize = rc + 1;
+ if (repbody->eadatasize != reqbody->eadatasize)
+ CERROR("Read shorter symlink %d, expected %d\n",
+ rc, reqbody->eadatasize - 1);
+ /* NULL terminate */
+ ((char *)ma->ma_lmm)[rc] = 0;
+
+ /* If the total CDEBUG() size is larger than a page, it
+ * will print a warning to the console, avoid this by
+ * printing just the last part of the symlink. */
+ CDEBUG(D_INODE, "symlink dest %s%.*s, len = %d\n",
+ print_limit < rc ? "..." : "", print_limit,
+ (char *)ma->ma_lmm + rc - print_limit, rc);
+ rc = 0;
}
}
return container_of0(o, struct mdt_object, mot_obj.mo_lu);
}
+struct mdt_object *mdt_object_new(const struct lu_env *env,
+ struct mdt_device *d,
+ const struct lu_fid *f)
+{
+ struct lu_object_conf conf = { .loc_flags = LOC_F_NEW };
+ struct lu_object *o;
+ struct mdt_object *m;
+ ENTRY;
+
+ CDEBUG(D_INFO, "Allocate object for "DFID"\n", PFID(f));
+ o = lu_object_find(env, &d->mdt_md_dev.md_lu_dev, f, &conf);
+ if (unlikely(IS_ERR(o)))
+ m = (struct mdt_object *)o;
+ else
+ m = mdt_obj(o);
+ RETURN(m);
+}
+
struct mdt_object *mdt_object_find(const struct lu_env *env,
struct mdt_device *d,
const struct lu_fid *f)
*/
.psc_thr = {
.tc_thr_name = LUSTRE_MDT_NAME,
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_ops = {
},
.psc_thr = {
.tc_thr_name = "mdt_rdpg",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_ops = {
},
.psc_thr = {
.tc_thr_name = "mdt_attr",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_ops = {
},
.psc_thr = {
.tc_thr_name = "mdt_mdsc",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_ops = {
},
.psc_thr = {
.tc_thr_name = "mdt_mdss",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
- .tc_ctx_tags = LCT_MD_THREAD | \
- LCT_DT_THREAD,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
+ .tc_ctx_tags = LCT_MD_THREAD | LCT_DT_THREAD
},
.psc_ops = {
.so_req_handler = mdt_mdss_handle,
},
.psc_thr = {
.tc_thr_name = "mdt_dtss",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
- .tc_ctx_tags = LCT_MD_THREAD | \
- LCT_DT_THREAD,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
+ .tc_ctx_tags = LCT_MD_THREAD | LCT_DT_THREAD
},
.psc_ops = {
.so_req_handler = mdt_dtss_handle,
},
.psc_thr = {
.tc_thr_name = "mdt_fld",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
- .tc_ctx_tags = LCT_DT_THREAD | \
- LCT_MD_THREAD,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
+ .tc_ctx_tags = LCT_DT_THREAD | LCT_MD_THREAD
},
.psc_ops = {
.so_req_handler = mdt_fld_handle,
},
.psc_thr = {
.tc_thr_name = "mdt_mds",
- .tc_nthrs_min = mdt_min_threads,
- .tc_nthrs_max = mdt_max_threads,
+ .tc_nthrs_min = MDT_MIN_THREADS,
+ .tc_nthrs_max = MDT_MAX_THREADS,
+ .tc_nthrs_user = mdt_num_threads,
.tc_ctx_tags = LCT_MD_THREAD,
},
.psc_ops = {
RETURN(0);
rc = lut_client_alloc(exp);
- if (rc == 0)
- rc = ldlm_init_export(exp);
if (rc)
- CERROR("%s: Error %d while initializing export\n",
- exp->exp_obd->obd_name, rc);
+ GOTO(err, rc);
+
+ rc = ldlm_init_export(exp);
+ if (rc)
+ GOTO(err_free, rc);
+
RETURN(rc);
+
+err_free:
+ lut_client_free(exp);
+err:
+ CERROR("%s: Error %d while initializing export\n",
+ exp->exp_obd->obd_name, rc);
+ return rc;
}
static int mdt_destroy_export(struct obd_export *exp)
struct lprocfs_static_vars lvars;
int rc;
- 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;
- }
-
lprocfs_mdt_init_vars(&lvars);
rc = class_register_type(&mdt_obd_device_ops, NULL,
lvars.module_vars, LUSTRE_MDT_NAME,