#define KEY_REGISTER_TARGET "register_target"
#define KEY_REVIMP_UPD "revimp_update"
#define KEY_SET_FS "set_fs"
+#define KEY_TGT_COUNT "tgt_count"
/* KEY_SET_INFO in lustre_idl.h */
#define KEY_SPTLRPC_CONF "sptlrpc_conf"
#define KEY_CONNECT_FLAG "connect_flags"
}
#endif
case LL_IOC_GETOBDCOUNT: {
- int count;
+ int count, vallen;
+ struct obd_export *exp;
if (cfs_copy_from_user(&count, (int *)arg, sizeof(int)))
RETURN(-EFAULT);
- if (!count) {
- /* get ost count */
- struct lov_obd *lov = &sbi->ll_dt_exp->exp_obd->u.lov;
- count = lov->desc.ld_tgt_count;
- } else {
- /* get mdt count */
- struct lmv_obd *lmv = &sbi->ll_md_exp->exp_obd->u.lmv;
- count = lmv->desc.ld_tgt_count;
+ /* get ost count when count is zero, get mdt count otherwise */
+ exp = count ? sbi->ll_md_exp : sbi->ll_dt_exp;
+ vallen = sizeof(count);
+ rc = obd_get_info(exp, sizeof(KEY_TGT_COUNT), KEY_TGT_COUNT,
+ &vallen, &count, NULL);
+ if (rc) {
+ CERROR("get target count failed: %d\n", rc);
+ RETURN(rc);
}
if (cfs_copy_to_user((int *)arg, &count, sizeof(int)))
rc = ptlrpc_obd_ping(obd);
GOTO(out, rc);
/*
- * Normally IOC_OBD_STATFS iocontrol is handled by LMV instead of MDC.
- * But when the cluster is upgraded from 1.8, there'd be no LMV layer
- * thus we might be called here. Eventually this code should be removed.
- * bz20731.
+ * Normally IOC_OBD_STATFS, OBD_IOC_QUOTACTL iocontrol are handled by
+ * LMV instead of MDC. But when the cluster is upgraded from 1.8,
+ * there'd be no LMV layer thus we might be called here. Eventually
+ * this code should be removed.
+ * bz20731, LU-592.
*/
case IOC_OBD_STATFS: {
struct obd_statfs stat_buf = {0};
GOTO(out, rc = 0);
}
+ case OBD_IOC_QUOTACTL: {
+ struct if_quotactl *qctl = karg;
+ struct obd_quotactl *oqctl;
+
+ OBD_ALLOC_PTR(oqctl);
+ if (!oqctl)
+ RETURN(-ENOMEM);
+
+ QCTL_COPY(oqctl, qctl);
+ rc = obd_quotactl(exp, oqctl);
+ if (rc == 0) {
+ QCTL_COPY(qctl, oqctl);
+ qctl->qc_valid = QC_MDTIDX;
+ qctl->obd_uuid = obd->u.cli.cl_target_uuid;
+ }
+ OBD_FREE_PTR(oqctl);
+ break;
+ }
case LL_IOC_GET_CONNECT_FLAGS: {
if (cfs_copy_to_user(uarg, &exp->exp_connect_flags,
sizeof(__u64)))
max_easize = val;
*max_easize = exp->exp_obd->u.cli.cl_max_mds_easize;
RETURN(0);
- }
- if (KEY_IS(KEY_CONN_DATA)) {
+ } else if (KEY_IS(KEY_CONN_DATA)) {
struct obd_import *imp = class_exp2cliimp(exp);
struct obd_connect_data *data = val;
*data = imp->imp_connect_data;
RETURN(0);
+ } else if (KEY_IS(KEY_TGT_COUNT)) {
+ *((int *)val) = 1;
+ RETURN(0);
}
rc = mdc_get_info_rpc(exp, keylen, key, *vallen, val);