Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-10629 lod: Clear OST pool with setstripe
[fs/lustre-release.git]
/
lustre
/
osp
/
lproc_osp.c
diff --git
a/lustre/osp/lproc_osp.c
b/lustre/osp/lproc_osp.c
index
b74c25e
..
03a03db
100644
(file)
--- a/
lustre/osp/lproc_osp.c
+++ b/
lustre/osp/lproc_osp.c
@@
-75,21
+75,19
@@
osp_active_seq_write(struct file *file, const char __user *buffer,
{
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
+ bool val;
int rc;
- __s64 val;
- rc =
lprocfs_str_to_s64
(buffer, count, &val);
+ rc =
kstrtobool_from_user
(buffer, count, &val);
if (rc)
return rc;
- if (val < 0 || val > 1)
- return -ERANGE;
LPROCFS_CLIMP_CHECK(dev);
/* opposite senses */
if (dev->u.cli.cl_import->imp_deactive == val)
rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
else
- CDEBUG(D_CONFIG, "activate %
ll
d: ignoring repeat request\n",
+ CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n",
val);
LPROCFS_CLIMP_EXIT(dev);
@@
-227,17
+225,17
@@
osp_max_rpcs_in_flight_seq_write(struct file *file, const char __user *buffer,
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
+ unsigned int val;
int rc;
- __s64 val;
if (osp == NULL)
return -EINVAL;
- rc =
lprocfs_str_to_s64(buffer, count
, &val);
+ rc =
kstrtouint_from_user(buffer, count, 0
, &val);
if (rc)
return rc;
- if (val
< 1 || val > INT_MAX
)
+ if (val
== 0
)
return -ERANGE;
osp->opd_sync_max_rpcs_in_flight = val;
@@
-282,17
+280,17
@@
osp_max_rpcs_in_progress_seq_write(struct file *file, const char __user *buffer,
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
+ unsigned int val;
int rc;
- __s64 val;
if (osp == NULL)
return -EINVAL;
- rc =
lprocfs_str_to_s64(buffer, count
, &val);
+ rc =
kstrtouint_from_user(buffer, count, 0
, &val);
if (rc)
return rc;
- if (val
< 1 || val > INT_MAX
)
+ if (val
== 0
)
return -ERANGE;
osp->opd_sync_max_rpcs_in_progress = val;
@@
-338,13
+336,13
@@
osp_create_count_seq_write(struct file *file, const char __user *buffer,
struct seq_file *m = file->private_data;
struct obd_device *obd = m->private;
struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
+ unsigned int val;
int rc, i;
- __s64 val;
if (osp == NULL || osp->opd_pre == NULL)
return 0;
- rc =
lprocfs_str_to_s64(buffer, count
, &val);
+ rc =
kstrtouint_from_user(buffer, count, 0
, &val);
if (rc)
return rc;
@@
-408,13
+406,13
@@
osp_max_create_count_seq_write(struct file *file, const char __user *buffer,
struct seq_file *m = file->private_data;
struct obd_device *obd = m->private;
struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
+ unsigned int val;
int rc;
- __s64 val;
if (osp == NULL || osp->opd_pre == NULL)
return 0;
- rc =
lprocfs_str_to_s64(buffer, count
, &val);
+ rc =
kstrtouint_from_user(buffer, count, 0
, &val);
if (rc)
return rc;
@@
-599,17
+597,17
@@
osp_maxage_seq_write(struct file *file, const char __user *buffer,
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
+ unsigned int val;
int rc;
- __s64 val;
if (osp == NULL)
return -EINVAL;
- rc =
lprocfs_str_to_s64(buffer, count
, &val);
+ rc =
kstrtouint_from_user(buffer, count, 0
, &val);
if (rc)
return rc;
- if (val
< 1 || val > INT_MAX
)
+ if (val
== 0
)
return -ERANGE;
osp->opd_statfs_maxage = val;
@@
-727,18
+725,14
@@
osp_lfsck_max_rpcs_in_flight_seq_write(struct file *file,
{
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
-
__s64
val;
+
unsigned int
val;
int rc;
- rc = lprocfs_str_to_s64(buffer, count, &val);
- if (rc == 0) {
- if (val < 0)
- return -ERANGE;
-
+ rc = kstrtouint_from_user(buffer, count, 0, &val);
+ if (!rc)
rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
- } else {
+ else
count = rc;
- }
return count;
}
@@
-1015,6
+1009,25
@@
static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
{ NULL }
};
+void osp_lprocfs_fini(struct osp_device *osp)
+{
+ struct obd_device *obd = osp->opd_obd;
+ struct kobject *osc;
+
+ osc = kset_find_obj(lustre_kset, "osc");
+ if (osc) {
+ sysfs_remove_link(osc, obd->obd_name);
+ kobject_put(osc);
+ }
+
+ if (!IS_ERR_OR_NULL(osp->opd_debugfs))
+ ldebugfs_remove(&osp->opd_debugfs);
+
+ ptlrpc_lprocfs_unregister_obd(obd);
+ if (osp->opd_symlink)
+ lprocfs_remove(&osp->opd_symlink);
+}
+
/**
* Initialize OSP lprocfs
*
@@
-1022,10
+1035,11
@@
static struct lprocfs_vars lprocfs_osp_osd_vars[] = {
*/
void osp_lprocfs_init(struct osp_device *osp)
{
- struct obd_device *obd = osp->opd_obd;
- struct proc_dir_entry *osc_proc_dir = NULL;
- struct obd_type *type;
- int rc;
+ struct obd_device *obd = osp->opd_obd;
+ struct proc_dir_entry *osc_proc_dir = NULL;
+ struct obd_type *type;
+ struct kobject *osc;
+ int rc;
if (osp->opd_connect_mdt)
obd->obd_vars = lprocfs_osp_md_vars;
@@
-1050,6
+1064,23
@@
void osp_lprocfs_init(struct osp_device *osp)
/* If the real OSC is present which is the case for setups
* with both server and clients on the same node then use
+ * the OSC's proc root
+ */
+ osc = kset_find_obj(lustre_kset, "osc");
+ if (osc) {
+ rc = sysfs_create_link(osc, &obd->obd_kset.kobj,
+ obd->obd_name);
+ kobject_put(osc);
+ }
+
+ osp->opd_debugfs = ldebugfs_add_symlink(obd->obd_name, "osc",
+ "../osp/%s", obd->obd_name);
+ if (!osp->opd_debugfs)
+ CERROR("%s: failed to create OSC debugfs symlink\n",
+ obd->obd_name);
+
+ /* If the real OSC is present which is the case for setups
+ * with both server and clients on the same node then use
* the OSC's proc root */
type = class_search_type(LUSTRE_OSC_NAME);
if (type != NULL && type->typ_procroot != NULL)