Commit cb1debff authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/lov: Move suitable variables from procfs to sysfs

Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aab38b00
...@@ -573,6 +573,8 @@ struct lov_obd { ...@@ -573,6 +573,8 @@ struct lov_obd {
void *lov_cache; void *lov_cache;
struct rw_semaphore lov_notify_lock; struct rw_semaphore lov_notify_lock;
struct kobject *lov_tgts_kobj;
}; };
struct lmv_tgt_desc { struct lmv_tgt_desc {
......
...@@ -127,7 +127,6 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, ...@@ -127,7 +127,6 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
struct obd_device *tgt_obd; struct obd_device *tgt_obd;
static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" }; static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
struct obd_import *imp; struct obd_import *imp;
struct proc_dir_entry *lov_proc_dir;
int rc; int rc;
if (!lov->lov_tgts[index]) if (!lov->lov_tgts[index])
...@@ -186,28 +185,10 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, ...@@ -186,28 +185,10 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
CDEBUG(D_CONFIG, "Connected tgt idx %d %s (%s) %sactive\n", index, CDEBUG(D_CONFIG, "Connected tgt idx %d %s (%s) %sactive\n", index,
obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in"); obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in");
lov_proc_dir = obd->obd_proc_private; if (lov->lov_tgts_kobj)
if (lov_proc_dir) { /* Even if we failed, that's ok */
struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd; rc = sysfs_create_link(lov->lov_tgts_kobj, &tgt_obd->obd_kobj,
struct proc_dir_entry *osc_symlink; tgt_obd->obd_name);
LASSERT(osc_obd != NULL);
LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC);
LASSERT(osc_obd->obd_type->typ_name != NULL);
osc_symlink = lprocfs_add_symlink(osc_obd->obd_name,
lov_proc_dir,
"../../../%s/%s",
osc_obd->obd_type->typ_name,
osc_obd->obd_name);
if (osc_symlink == NULL) {
CERROR("could not register LOV target /proc/fs/lustre/%s/%s/target_obds/%s.",
obd->obd_type->typ_name, obd->obd_name,
osc_obd->obd_name);
lprocfs_remove(&lov_proc_dir);
obd->obd_proc_private = NULL;
}
}
return 0; return 0;
} }
...@@ -239,6 +220,10 @@ static int lov_connect(const struct lu_env *env, ...@@ -239,6 +220,10 @@ static int lov_connect(const struct lu_env *env,
lov->lov_ocd = *data; lov->lov_ocd = *data;
obd_getref(obd); obd_getref(obd);
lov->lov_tgts_kobj = kobject_create_and_add("target_obds",
&obd->obd_kobj);
for (i = 0; i < lov->desc.ld_tgt_count; i++) { for (i = 0; i < lov->desc.ld_tgt_count; i++) {
tgt = lov->lov_tgts[i]; tgt = lov->lov_tgts[i];
if (!tgt || obd_uuid_empty(&tgt->ltd_uuid)) if (!tgt || obd_uuid_empty(&tgt->ltd_uuid))
...@@ -268,7 +253,6 @@ static int lov_connect(const struct lu_env *env, ...@@ -268,7 +253,6 @@ static int lov_connect(const struct lu_env *env,
static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
{ {
struct proc_dir_entry *lov_proc_dir;
struct lov_obd *lov = &obd->u.lov; struct lov_obd *lov = &obd->u.lov;
struct obd_device *osc_obd; struct obd_device *osc_obd;
int rc; int rc;
...@@ -284,10 +268,10 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) ...@@ -284,10 +268,10 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
} }
if (osc_obd) { if (osc_obd) {
lov_proc_dir = obd->obd_proc_private; if (lov->lov_tgts_kobj)
if (lov_proc_dir) { sysfs_remove_link(lov->lov_tgts_kobj,
lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir); osc_obd->obd_name);
}
/* Pass it on to our clients. /* Pass it on to our clients.
* XXX This should be an argument to disconnect, * XXX This should be an argument to disconnect,
* XXX not a back-door flag on the OBD. Ah well. * XXX not a back-door flag on the OBD. Ah well.
...@@ -337,6 +321,10 @@ static int lov_disconnect(struct obd_export *exp) ...@@ -337,6 +321,10 @@ static int lov_disconnect(struct obd_export *exp)
lov_del_target(obd, i, NULL, lov->lov_tgts[i]->ltd_gen); lov_del_target(obd, i, NULL, lov->lov_tgts[i]->ltd_gen);
} }
} }
if (lov->lov_tgts_kobj)
kobject_put(lov->lov_tgts_kobj);
obd_putref(obd); obd_putref(obd);
out: out:
......
...@@ -166,29 +166,29 @@ static ssize_t lov_stripecount_seq_write(struct file *file, ...@@ -166,29 +166,29 @@ static ssize_t lov_stripecount_seq_write(struct file *file,
} }
LPROC_SEQ_FOPS(lov_stripecount); LPROC_SEQ_FOPS(lov_stripecount);
static int lov_numobd_seq_show(struct seq_file *m, void *v) static ssize_t numobd_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{ {
struct obd_device *dev = (struct obd_device *)m->private; struct obd_device *dev = container_of(kobj, struct obd_device,
obd_kobj);
struct lov_desc *desc; struct lov_desc *desc;
LASSERT(dev != NULL);
desc = &dev->u.lov.desc; desc = &dev->u.lov.desc;
seq_printf(m, "%u\n", desc->ld_tgt_count); return sprintf(buf, "%u\n", desc->ld_tgt_count);
return 0;
} }
LPROC_SEQ_FOPS_RO(lov_numobd); LUSTRE_RO_ATTR(numobd);
static int lov_activeobd_seq_show(struct seq_file *m, void *v) static ssize_t activeobd_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{ {
struct obd_device *dev = (struct obd_device *)m->private; struct obd_device *dev = container_of(kobj, struct obd_device,
obd_kobj);
struct lov_desc *desc; struct lov_desc *desc;
LASSERT(dev != NULL);
desc = &dev->u.lov.desc; desc = &dev->u.lov.desc;
seq_printf(m, "%u\n", desc->ld_active_tgt_count); return sprintf(buf, "%u\n", desc->ld_active_tgt_count);
return 0;
} }
LPROC_SEQ_FOPS_RO(lov_activeobd); LUSTRE_RO_ATTR(activeobd);
static int lov_desc_uuid_seq_show(struct seq_file *m, void *v) static int lov_desc_uuid_seq_show(struct seq_file *m, void *v)
{ {
...@@ -267,16 +267,25 @@ static struct lprocfs_vars lprocfs_lov_obd_vars[] = { ...@@ -267,16 +267,25 @@ static struct lprocfs_vars lprocfs_lov_obd_vars[] = {
{ "stripeoffset", &lov_stripeoffset_fops, NULL }, { "stripeoffset", &lov_stripeoffset_fops, NULL },
{ "stripecount", &lov_stripecount_fops, NULL }, { "stripecount", &lov_stripecount_fops, NULL },
{ "stripetype", &lov_stripetype_fops, NULL }, { "stripetype", &lov_stripetype_fops, NULL },
{ "numobd", &lov_numobd_fops, NULL, 0 },
{ "activeobd", &lov_activeobd_fops, NULL, 0 },
/*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/ /*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/
{ "desc_uuid", &lov_desc_uuid_fops, NULL, 0 }, { "desc_uuid", &lov_desc_uuid_fops, NULL, 0 },
{ NULL } { NULL }
}; };
static struct attribute *lov_attrs[] = {
&lustre_attr_activeobd.attr,
&lustre_attr_numobd.attr,
NULL,
};
static struct attribute_group lov_attr_group = {
.attrs = lov_attrs,
};
void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars) void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars)
{ {
lvars->obd_vars = lprocfs_lov_obd_vars; lvars->sysfs_vars = &lov_attr_group;
lvars->obd_vars = lprocfs_lov_obd_vars;
} }
const struct file_operations lov_proc_target_fops = { const struct file_operations lov_proc_target_fops = {
......
...@@ -505,3 +505,16 @@ Description: ...@@ -505,3 +505,16 @@ Description:
Controls how many times to try and resend RPCs to this target Controls how many times to try and resend RPCs to this target
that failed with "recoverable" status, such as EAGAIN, that failed with "recoverable" status, such as EAGAIN,
ENOMEM. ENOMEM.
What: /sys/fs/lustre/lov/{connection_name}/numobd
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Number of OSC targets managed by this LOV instance.
What: /sys/fs/lustre/lov/{connection_name}/activeobd
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Number of OSC targets managed by this LOV instance that are
actually active.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment