dd_kobj);
struct lu_device *lu = dt2lu_dev(dt);
struct obd_device *obd = lu->ld_obd;
+ struct obd_import *imp;
int rc;
- LPROCFS_CLIMP_CHECK(obd);
- rc = sprintf(buf, "%d\n", !obd->u.cli.cl_import->imp_deactive);
- LPROCFS_CLIMP_EXIT(obd);
+ with_imp_locked(obd, imp, rc)
+ rc = sprintf(buf, "%d\n", !imp->imp_deactive);
return rc;
}
dd_kobj);
struct lu_device *lu = dt2lu_dev(dt);
struct obd_device *obd = lu->ld_obd;
+ struct obd_import *imp, *imp0;
bool val;
int rc;
if (rc)
return rc;
- LPROCFS_CLIMP_CHECK(obd);
+ with_imp_locked(obd, imp0, rc)
+ imp = class_import_get(imp0);
+ if (rc)
+ return rc;
/* opposite senses */
- if (obd->u.cli.cl_import->imp_deactive == val)
- rc = ptlrpc_set_import_active(obd->u.cli.cl_import, val);
+ if (imp->imp_deactive == val)
+ rc = ptlrpc_set_import_active(imp, val);
else
CDEBUG(D_CONFIG, "activate %u: ignoring repeat request\n",
(unsigned int)val);
- LPROCFS_CLIMP_EXIT(obd);
- return count;
+ class_import_put(imp);
+
+ return rc ?: count;
}
LUSTRE_RW_ATTR(active);
if (rc)
return rc;
- if (val < 0 || val > INT_MAX)
- return -ERANGE;
- if (val > OST_MAX_PRECREATE)
+ if (val && (val < OST_MIN_PRECREATE ||
+ val > OST_MAX_PRECREATE))
return -ERANGE;
if (osp->opd_pre_create_count > val)
osp->opd_pre_create_count = val;
+ /* Can be 0 after setting max_create_count to 0 */
+ if (osp->opd_pre_create_count == 0 && val != 0)
+ osp->opd_pre_create_count = OST_MIN_PRECREATE;
+
osp->opd_pre_max_create_count = val;
return count;
struct obd_device *obd = lu->ld_obd;
int rc;
- LPROCFS_CLIMP_CHECK(obd);
rc = ptlrpc_obd_ping(obd);
- LPROCFS_CLIMP_EXIT(obd);
return rc;
}
dd_kobj);
struct lu_device *lu = dt2lu_dev(dt);
struct obd_device *obd = lu->ld_obd;
+ struct obd_import *imp;
struct ptlrpc_connection *conn;
ssize_t count;
- LPROCFS_CLIMP_CHECK(obd);
- conn = obd->u.cli.cl_import->imp_connection;
- if (conn && obd->u.cli.cl_import)
- count = sprintf(buf, "%s\n", conn->c_remote_uuid.uuid);
- else
- count = sprintf(buf, "%s\n", "<none>");
+ with_imp_locked(obd, imp, count) {
+ conn = imp->imp_connection;
+ if (conn)
+ count = sprintf(buf, "%s\n", conn->c_remote_uuid.uuid);
+ else
+ count = sprintf(buf, "%s\n", "<none>");
+ }
- LPROCFS_CLIMP_EXIT(obd);
return count;
}
LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, server_uuid);
LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, timeouts);
-LPROC_SEQ_FOPS_RW_TYPE(osp, import);
+LDEBUGFS_SEQ_FOPS_RW_TYPE(osp, import);
LDEBUGFS_SEQ_FOPS_RO_TYPE(osp, state);
/**
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
- __s64 val;
+ char kernbuf[22] = "";
+ u64 val;
int rc;
if (osp == NULL || osp->opd_pre == NULL)
return -EINVAL;
- rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
- if (rc)
+ if (count >= sizeof(kernbuf))
+ return -EINVAL;
+
+ if (copy_from_user(kernbuf, buffer, count))
+ return -EFAULT;
+ kernbuf[count] = 0;
+
+ rc = sysfs_memparse(kernbuf, count, &val, "MiB");
+ if (rc < 0)
return rc;
val >>= 20;
if (val < 1)
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
- __s64 val;
+ char kernbuf[22] = "";
+ u64 val;
int rc;
if (osp == NULL || osp->opd_pre == NULL)
return -EINVAL;
- rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
- if (rc)
+ if (count >= sizeof(kernbuf))
+ return -EINVAL;
+
+ if (copy_from_user(kernbuf, buffer, count))
+ return -EFAULT;
+ kernbuf[count] = 0;
+
+ rc = sysfs_memparse(kernbuf, count, &val, "MiB");
+ if (rc < 0)
return rc;
val >>= 20;
}
LUSTRE_WO_ATTR(force_sync);
-static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
+static struct ldebugfs_vars ldebugfs_osp_obd_vars[] = {
{ .name = "connect_flags",
.fops = &osp_connect_flags_fops },
{ .name = "ost_server_uuid",
{ NULL }
};
-static struct lprocfs_vars lprocfs_osp_md_vars[] = {
+static struct ldebugfs_vars ldebugfs_osp_md_vars[] = {
{ .name = "connect_flags",
.fops = &osp_connect_flags_fops },
{ .name = "mdt_server_uuid",
kobject_put(osc);
}
- if (!IS_ERR_OR_NULL(osp->opd_debugfs))
- ldebugfs_remove(&osp->opd_debugfs);
+ debugfs_remove_recursive(osp->opd_debugfs);
+ osp->opd_debugfs = NULL;
ptlrpc_lprocfs_unregister_obd(obd);
- if (!IS_ERR_OR_NULL(obd->obd_debugfs_entry))
- ldebugfs_remove(&obd->obd_debugfs_entry);
+ debugfs_remove_recursive(obd->obd_debugfs_entry);
+ obd->obd_debugfs_entry = NULL;
dt_tunables_fini(&osp->opd_dt_dev);
}
if (osp->opd_connect_mdt) {
osp->opd_dt_dev.dd_ktype.default_attrs = osp_md_attrs;
- obd->obd_vars = lprocfs_osp_md_vars;
+ obd->obd_debugfs_vars = ldebugfs_osp_md_vars;
} else {
osp->opd_dt_dev.dd_ktype.default_attrs = osp_obd_attrs;
- obd->obd_vars = lprocfs_osp_obd_vars;
+ obd->obd_debugfs_vars = ldebugfs_osp_obd_vars;
}
rc = dt_tunables_init(&osp->opd_dt_dev, obd->obd_type, obd->obd_name,
/* Since we register the obd device with ptlrpc / sptlrpc we
* have to register debugfs with obd_device
*/
- obd->obd_debugfs_entry = ldebugfs_register(obd->obd_name,
- obd->obd_type->typ_debugfs_entry,
- obd->obd_vars, obd);
- if (IS_ERR_OR_NULL(obd->obd_debugfs_entry)) {
- rc = obd->obd_debugfs_entry ? PTR_ERR(obd->obd_debugfs_entry)
- : -ENOMEM;
- CERROR("%s: error %d setting up debugfs\n",
- obd->obd_name, rc);
- obd->obd_debugfs_entry = NULL;
- dt_tunables_fini(&osp->opd_dt_dev);
- return;
- }
+ obd->obd_debugfs_entry = debugfs_create_dir(
+ obd->obd_name, obd->obd_type->typ_debugfs_entry);
+ ldebugfs_add_vars(obd->obd_debugfs_entry, obd->obd_debugfs_vars, obd);
sptlrpc_lprocfs_cliobd_attach(obd);
ptlrpc_lprocfs_register_obd(obd);