static inline int LPROCFS_ENTRY_CHECK(struct inode *inode)
{ return 0; }
#endif
-extern int lprocfs_obd_setup(struct obd_device *dev);
+
+extern int lprocfs_obd_setup(struct obd_device *dev, bool uuid_only);
extern int lprocfs_obd_cleanup(struct obd_device *obd);
#ifdef HAVE_SERVER_SUPPORT
extern const struct file_operations lprocfs_evict_client_fops;
lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off);
-/* Statfs helpers */
-extern int lprocfs_blksize_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_filestotal_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_filesfree_seq_show(struct seq_file *m, void *data);
-
extern int lprocfs_seq_read_frac_helper(struct seq_file *m, long val, int mult);
extern int lprocfs_read_frac_helper(char *buffer, unsigned long count,
long val, int mult);
static inline void lprocfs_remove_proc_entry(const char *name,
struct proc_dir_entry *parent)
{ return; }
-static inline int lprocfs_obd_setup(struct obd_device *dev)
+static inline int lprocfs_obd_setup(struct obd_device *dev, bool uuid_only)
{ return 0; }
static inline int lprocfs_obd_cleanup(struct obd_device *dev)
{ return 0; }
int typ_refcnt;
struct lu_device_type *typ_lu;
spinlock_t obd_type_lock;
+ struct kobject *typ_kobj;
};
struct brw_page {
struct proc_dir_entry *obd_proc_exports_entry;
struct proc_dir_entry *obd_svc_procroot;
struct lprocfs_stats *obd_svc_stats;
+ struct attribute_group *obd_attrs;
struct lprocfs_vars *obd_vars;
atomic_t obd_evict_inprogress;
wait_queue_head_t obd_evict_inprogress_waitq;
/**
* List of outstanding class_incref()'s fo this OBD. For debugging. */
struct lu_ref obd_reference;
+
+ struct kobject obd_kobj; /* sysfs object */
+ struct completion obd_kobj_unregister;
};
/* get/set_info keys */
#ifdef CONFIG_PROC_FS
obd->obd_vars = lprocfs_lmv_obd_vars;
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, true);
lprocfs_alloc_md_stats(obd, 0);
rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd",
0444, &lmv_proc_target_fops, obd);
return 0;
}
-LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid);
-
struct lprocfs_vars lprocfs_lmv_obd_vars[] = {
{ .name = "numobd",
.fops = &lmv_numobd_fops },
{ .name = "activeobd",
.fops = &lmv_activeobd_fops },
- { .name = "uuid",
- .fops = &lmv_uuid_fops },
{ .name = "desc_uuid",
.fops = &lmv_desc_uuid_fops },
{ NULL }
return 0;
}
-LPROC_SEQ_FOPS_RO_TYPE(lod, uuid);
-
LPROC_SEQ_FOPS_RO_TYPE(lod, dt_blksize);
LPROC_SEQ_FOPS_RO_TYPE(lod, dt_kbytestotal);
LPROC_SEQ_FOPS_RO_TYPE(lod, dt_kbytesfree);
LPROC_SEQ_FOPS(lod_lmv_failout);
static struct lprocfs_vars lprocfs_lod_obd_vars[] = {
- { .name = "uuid",
- .fops = &lod_uuid_fops },
{ .name = "stripesize",
.fops = &lod_stripesize_fops },
{ .name = "stripeoffset",
int rc;
obd->obd_vars = lprocfs_lod_obd_vars;
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, true);
if (rc) {
CERROR("%s: cannot setup procfs entry: %d\n",
obd->obd_name, rc);
obd->obd_proc_entry = NULL;
}
} else {
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, false);
}
if (rc == 0) {
return 0;
}
-LPROC_SEQ_FOPS_RO_TYPE(lov, uuid);
-LPROC_SEQ_FOPS_RO_TYPE(lov, filestotal);
-LPROC_SEQ_FOPS_RO_TYPE(lov, filesfree);
-LPROC_SEQ_FOPS_RO_TYPE(lov, blksize);
-LPROC_SEQ_FOPS_RO_TYPE(lov, kbytestotal);
-LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree);
-LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail);
-
struct lprocfs_vars lprocfs_lov_obd_vars[] = {
- { .name = "uuid",
- .fops = &lov_uuid_fops },
{ .name = "stripesize",
.fops = &lov_stripesize_fops },
{ .name = "stripeoffset",
.fops = &lov_numobd_fops },
{ .name = "activeobd",
.fops = &lov_activeobd_fops },
- { .name = "filestotal",
- .fops = &lov_filestotal_fops },
- { .name = "filesfree",
- .fops = &lov_filesfree_fops },
- { .name = "blocksize",
- .fops = &lov_blksize_fops },
- { .name = "kbytestotal",
- .fops = &lov_kbytestotal_fops },
- { .name = "kbytesfree",
- .fops = &lov_kbytesfree_fops },
- { .name = "kbytesavail",
- .fops = &lov_kbytesavail_fops },
{ .name = "desc_uuid",
.fops = &lov_desc_uuid_fops },
{ NULL }
LPROC_SEQ_FOPS_WO_TYPE(mdc, ping);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, uuid);
LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, blksize);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, kbytestotal);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, kbytesfree);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, kbytesavail);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, filestotal);
-LPROC_SEQ_FOPS_RO_TYPE(mdc, filesfree);
LPROC_SEQ_FOPS_RO_TYPE(mdc, server_uuid);
LPROC_SEQ_FOPS_RO_TYPE(mdc, conn_uuid);
LPROC_SEQ_FOPS_RO_TYPE(mdc, timeouts);
LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov);
struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
- { .name = "uuid",
- .fops = &mdc_uuid_fops },
{ .name = "ping",
.fops = &mdc_ping_fops,
.proc_mode = 0222 },
{ .name = "connect_flags",
.fops = &mdc_connect_flags_fops },
- { .name = "blocksize",
- .fops = &mdc_blksize_fops },
- { .name = "kbytestotal",
- .fops = &mdc_kbytestotal_fops },
- { .name = "kbytesfree",
- .fops = &mdc_kbytesfree_fops },
- { .name = "kbytesavail",
- .fops = &mdc_kbytesavail_fops },
- { .name = "filestotal",
- .fops = &mdc_filestotal_fops },
- { .name = "filesfree",
- .fops = &mdc_filesfree_fops },
{ .name = "mds_server_uuid",
.fops = &mdc_server_uuid_fops },
{ .name = "mds_conn_uuid",
GOTO(err_ptlrpcd_decref, rc);
#ifdef CONFIG_PROC_FS
obd->obd_vars = lprocfs_mdc_obd_vars;
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, false);
lprocfs_alloc_md_stats(obd, 0);
#endif
sptlrpc_lprocfs_cliobd_attach(obd);
}
LPROC_SEQ_FOPS(mdt_sync_count);
-
-LPROC_SEQ_FOPS_RO_TYPE(mdt, uuid);
LPROC_SEQ_FOPS_RO_TYPE(mdt, recovery_status);
LPROC_SEQ_FOPS_RO_TYPE(mdt, num_exports);
LPROC_SEQ_FOPS_RO_TYPE(mdt, target_instance);
LPROC_SEQ_FOPS_RW_TYPE(mdt, recovery_time_soft);
static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
- { .name = "uuid",
- .fops = &mdt_uuid_fops },
{ .name = "recovery_status",
.fops = &mdt_recovery_status_fops },
{ .name = "num_exports",
LASSERT(name != NULL);
obd->obd_vars = lprocfs_mdt_obd_vars;
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, true);
if (rc) {
CERROR("%s: cannot create proc entries: rc = %d\n",
mdt_obd_name(mdt), rc);
RETURN(NULL);
}
-LPROC_SEQ_FOPS_RO_TYPE(mds, uuid);
-
-static struct lprocfs_vars lprocfs_mds_obd_vars[] = {
- {
- .name = "uuid",
- .fops = &mds_uuid_fops
- },
- {
- .name = NULL
- }
-};
-
static struct lu_device *mds_device_alloc(const struct lu_env *env,
struct lu_device_type *t,
struct lustre_cfg *cfg)
/* set this lu_device to obd, because error handling need it */
obd->obd_lu_dev = l;
- obd->obd_vars = lprocfs_mds_obd_vars;
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, true);
if (rc != 0) {
mds_device_free(env, l);
l = ERR_PTR(rc);
#ifdef CONFIG_PROC_FS
-LPROC_SEQ_FOPS_RO_TYPE(mgc, uuid);
LPROC_SEQ_FOPS_RO_TYPE(mgc, connect_flags);
LPROC_SEQ_FOPS_RO_TYPE(mgc, server_uuid);
LPROC_SEQ_FOPS_RO_TYPE(mgc, conn_uuid);
LPROC_SEQ_FOPS_RO(mgc_ir_state);
struct lprocfs_vars lprocfs_mgc_obd_vars[] = {
- { .name = "uuid",
- .fops = &mgc_uuid_fops },
{ .name = "ping",
.fops = &mgc_ping_fops,
.proc_mode = 0222 },
#ifdef CONFIG_PROC_FS
obd->obd_vars = lprocfs_mgc_obd_vars;
- lprocfs_obd_setup(obd);
+ lprocfs_obd_setup(obd, true);
#endif
sptlrpc_lprocfs_cliobd_attach(obd);
return 0;
}
-LPROC_SEQ_FOPS_RO_TYPE(mgs, uuid);
LPROC_SEQ_FOPS_RO_TYPE(mgs, num_exports);
LPROC_SEQ_FOPS_RO_TYPE(mgs, hash);
LPROC_SEQ_FOPS_WO_TYPE(mgs, evict_client);
LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout);
static struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
- { .name = "uuid",
- .fops = &mgs_uuid_fops },
{ .name = "num_exports",
.fops = &mgs_num_exports_fops },
{ .name = "hash_stats",
int rc;
obd->obd_vars = lprocfs_mgs_obd_vars;
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, true);
if (rc != 0)
GOTO(out, rc);
}
}
#endif
+ type->typ_kobj = kobject_create_and_add(type->typ_name, lustre_kobj);
+ if (!type->typ_kobj) {
+ rc = -ENOMEM;
+ GOTO(failed, rc);
+ }
+
if (ldt != NULL) {
type->typ_lu = ldt;
rc = lu_device_type_init(ldt);
RETURN (0);
failed:
+ if (type->typ_kobj)
+ kobject_put(type->typ_kobj);
if (type->typ_name != NULL) {
#ifdef CONFIG_PROC_FS
if (type->typ_procroot != NULL)
RETURN(-EBUSY);
}
+ if (type->typ_kobj)
+ kobject_put(type->typ_kobj);
+
/* we do not use type->typ_procroot as for compatibility purposes
* other modules can share names (i.e. lod can use lov entry). so
* we can't reference pointer as it can get invalided when another
}
EXPORT_SYMBOL(lprocfs_uuid_seq_show);
+static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+
+ return sprintf(buf, "%s\n", obd->obd_uuid.uuid);
+}
+LUSTRE_RO_ATTR(uuid);
+
int lprocfs_name_seq_show(struct seq_file *m, void *data)
{
struct obd_device *dev = data;
}
EXPORT_SYMBOL(lprocfs_name_seq_show);
-int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
+static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = data;
- struct obd_statfs osfs;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+ struct obd_statfs osfs;
int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- seq_printf(m, "%u\n", osfs.os_bsize);
+ return sprintf(buf, "%u\n", osfs.os_bsize);
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_blksize_seq_show);
+LUSTRE_RO_ATTR(blocksize);
-int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
+static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = data;
- struct obd_statfs osfs;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+ struct obd_statfs osfs;
int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
- __u32 blk_size = osfs.os_bsize >> 10;
- __u64 result = osfs.os_blocks;
+ u32 blk_size = osfs.os_bsize >> 10;
+ u64 result = osfs.os_blocks;
while (blk_size >>= 1)
result <<= 1;
- seq_printf(m, "%llu\n", result);
+ return sprintf(buf, "%llu\n", result);
}
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_kbytestotal_seq_show);
+LUSTRE_RO_ATTR(kbytestotal);
-int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
+static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = data;
- struct obd_statfs osfs;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+ struct obd_statfs osfs;
int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
- __u32 blk_size = osfs.os_bsize >> 10;
- __u64 result = osfs.os_bfree;
+ u32 blk_size = osfs.os_bsize >> 10;
+ u64 result = osfs.os_bfree;
while (blk_size >>= 1)
result <<= 1;
- seq_printf(m, "%llu\n", result);
+ return sprintf(buf, "%llu\n", result);
}
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_kbytesfree_seq_show);
+LUSTRE_RO_ATTR(kbytesfree);
-int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
+static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = data;
- struct obd_statfs osfs;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+ struct obd_statfs osfs;
int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc) {
- __u32 blk_size = osfs.os_bsize >> 10;
- __u64 result = osfs.os_bavail;
+ u32 blk_size = osfs.os_bsize >> 10;
+ u64 result = osfs.os_bavail;
while (blk_size >>= 1)
result <<= 1;
- seq_printf(m, "%llu\n", result);
+ return sprintf(buf, "%llu\n", result);
}
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_kbytesavail_seq_show);
+LUSTRE_RO_ATTR(kbytesavail);
-int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
+static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = data;
- struct obd_statfs osfs;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+ struct obd_statfs osfs;
int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- seq_printf(m, "%llu\n", osfs.os_files);
+ return sprintf(buf, "%llu\n", osfs.os_files);
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_filestotal_seq_show);
+LUSTRE_RO_ATTR(filestotal);
-int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
+static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = data;
- struct obd_statfs osfs;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+ struct obd_statfs osfs;
int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
OBD_STATFS_NODELAY);
if (!rc)
- seq_printf(m, "%llu\n", osfs.os_ffree);
+ return sprintf(buf, "%llu\n", osfs.os_ffree);
+
return rc;
}
-EXPORT_SYMBOL(lprocfs_filesfree_seq_show);
+LUSTRE_RO_ATTR(filesfree);
int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data)
{
}
EXPORT_SYMBOL(lprocfs_connect_flags_seq_show);
+static struct attribute *obd_def_uuid_attrs[] = {
+ &lustre_attr_uuid.attr,
+ NULL,
+};
+
+static struct attribute *obd_def_attrs[] = {
+ &lustre_attr_blocksize.attr,
+ &lustre_attr_kbytestotal.attr,
+ &lustre_attr_kbytesfree.attr,
+ &lustre_attr_kbytesavail.attr,
+ &lustre_attr_filestotal.attr,
+ &lustre_attr_filesfree.attr,
+ &lustre_attr_uuid.attr,
+ NULL,
+};
+
+static void obd_sysfs_release(struct kobject *kobj)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kobj);
+
+ complete(&obd->obd_kobj_unregister);
+}
+
+static struct kobj_type obd_ktype = {
+ .sysfs_ops = &lustre_sysfs_ops,
+ .release = obd_sysfs_release,
+};
+
int
-lprocfs_obd_setup(struct obd_device *obd)
+lprocfs_obd_setup(struct obd_device *obd, bool uuid_only)
{
int rc = 0;
LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
LASSERT(obd->obd_type->typ_procroot != NULL);
+ if (uuid_only)
+ obd_ktype.default_attrs = obd_def_uuid_attrs;
+ else
+ obd_ktype.default_attrs = obd_def_attrs;
+
+ init_completion(&obd->obd_kobj_unregister);
+ rc = kobject_init_and_add(&obd->obd_kobj, &obd_ktype,
+ obd->obd_type->typ_kobj,
+ "%s", obd->obd_name);
+ if (rc)
+ return rc;
+
+ if (obd->obd_attrs) {
+ rc = sysfs_create_group(&obd->obd_kobj, obd->obd_attrs);
+ if (rc) {
+ kobject_put(&obd->obd_kobj);
+ return rc;
+ }
+ }
+
obd->obd_proc_entry = lprocfs_register(obd->obd_name,
obd->obd_type->typ_procroot,
obd->obd_vars, obd);
if (IS_ERR(obd->obd_proc_entry)) {
+ kobject_put(&obd->obd_kobj);
rc = PTR_ERR(obd->obd_proc_entry);
CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name);
obd->obd_proc_entry = NULL;
}
+
return rc;
}
EXPORT_SYMBOL(lprocfs_obd_setup);
int lprocfs_obd_cleanup(struct obd_device *obd)
{
- if (!obd)
- return -EINVAL;
- if (obd->obd_proc_exports_entry) {
- /* Should be no exports left */
- lprocfs_remove(&obd->obd_proc_exports_entry);
- obd->obd_proc_exports_entry = NULL;
- }
- if (obd->obd_proc_entry) {
- lprocfs_remove(&obd->obd_proc_entry);
- obd->obd_proc_entry = NULL;
- }
- return 0;
+ if (!obd)
+ return -EINVAL;
+
+ if (obd->obd_proc_exports_entry) {
+ /* Should be no exports left */
+ lprocfs_remove(&obd->obd_proc_exports_entry);
+ obd->obd_proc_exports_entry = NULL;
+ }
+
+ if (obd->obd_proc_entry) {
+ lprocfs_remove(&obd->obd_proc_entry);
+ obd->obd_proc_entry = NULL;
+ }
+
+ kobject_put(&obd->obd_kobj);
+ wait_for_completion(&obd->obd_kobj_unregister);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_obd_cleanup);
return rc;
}
-LPROC_SEQ_FOPS_RO_TYPE(echo, uuid);
-static struct lprocfs_vars lprocfs_echo_obd_vars[] = {
- { .name = "uuid",
- .fops = &echo_uuid_fops },
- { NULL }
-};
-
static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
int rc;
LVB_T_NONE, NULL, &obd->u.echo.eo_nl_lock);
LASSERT (rc == ELDLM_OK);
- obd->obd_vars = lprocfs_echo_obd_vars;
- if (lprocfs_obd_setup(obd) == 0 &&
+ if (!lprocfs_obd_setup(obd, true) &&
lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
LPROCFS_CNTR_AVGMINMAX,
}
LPROC_SEQ_FOPS_RO(ofd_site_stats);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytestotal);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesfree);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, kbytesavail);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, filestotal);
-LPROC_SEQ_FOPS_RO_TYPE(ofd, filesfree);
-
LPROC_SEQ_FOPS_RO_TYPE(ofd, recovery_status);
LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_soft);
LPROC_SEQ_FOPS_RW_TYPE(ofd, recovery_time_hard);
LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval);
struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
- { .name = "uuid",
- .fops = &ofd_uuid_fops },
- { .name = "blocksize",
- .fops = &ofd_blksize_fops },
- { .name = "kbytestotal",
- .fops = &ofd_kbytestotal_fops },
- { .name = "kbytesfree",
- .fops = &ofd_kbytesfree_fops },
- { .name = "kbytesavail",
- .fops = &ofd_kbytesavail_fops },
- { .name = "filestotal",
- .fops = &ofd_filestotal_fops },
- { .name = "filesfree",
- .fops = &ofd_filesfree_fops },
{ .name = "seqs_allocated",
.fops = &ofd_seqs_fops },
{ .name = "fstype",
/* lprocfs must be setup before the ofd so state can be safely added
* to /proc incrementally as the ofd is setup */
obd->obd_vars = lprocfs_ofd_obd_vars;
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, false);
if (rc) {
CERROR("%s: lprocfs_obd_setup failed: %d.\n",
obd->obd_name, rc);
}
LPROC_SEQ_FOPS_RO(osc_unstable_stats);
-LPROC_SEQ_FOPS_RO_TYPE(osc, uuid);
LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags);
-LPROC_SEQ_FOPS_RO_TYPE(osc, blksize);
-LPROC_SEQ_FOPS_RO_TYPE(osc, kbytestotal);
-LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesfree);
-LPROC_SEQ_FOPS_RO_TYPE(osc, kbytesavail);
-LPROC_SEQ_FOPS_RO_TYPE(osc, filestotal);
-LPROC_SEQ_FOPS_RO_TYPE(osc, filesfree);
LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid);
LPROC_SEQ_FOPS_RO_TYPE(osc, conn_uuid);
LPROC_SEQ_FOPS_RO_TYPE(osc, timeouts);
LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov);
struct lprocfs_vars lprocfs_osc_obd_vars[] = {
- { .name = "uuid",
- .fops = &osc_uuid_fops },
{ .name = "ping",
.fops = &osc_ping_fops,
.proc_mode = 0222 },
{ .name = "connect_flags",
.fops = &osc_connect_flags_fops },
- { .name = "blocksize",
- .fops = &osc_blksize_fops },
- { .name = "kbytestotal",
- .fops = &osc_kbytestotal_fops },
- { .name = "kbytesfree",
- .fops = &osc_kbytesfree_fops },
- { .name = "kbytesavail",
- .fops = &osc_kbytesavail_fops },
- { .name = "filestotal",
- .fops = &osc_filestotal_fops },
- { .name = "filesfree",
- .fops = &osc_filesfree_fops },
{ .name = "ost_server_uuid",
.fops = &osc_server_uuid_fops },
{ .name = "ost_conn_uuid",
obd->obd_proc_entry = NULL;
}
} else {
- rc = lprocfs_obd_setup(obd);
+ rc = lprocfs_obd_setup(obd, false);
}
/* If the basic OSC proc tree construction succeeded then
LPROC_SEQ_FOPS(osp_lfsck_max_rpcs_in_flight);
LPROC_SEQ_FOPS_WO_TYPE(osp, ping);
-LPROC_SEQ_FOPS_RO_TYPE(osp, uuid);
LPROC_SEQ_FOPS_RO_TYPE(osp, connect_flags);
LPROC_SEQ_FOPS_RO_TYPE(osp, server_uuid);
LPROC_SEQ_FOPS_RO_TYPE(osp, conn_uuid);
LPROC_SEQ_FOPS(osp_reserved_mb_low);
static struct lprocfs_vars lprocfs_osp_obd_vars[] = {
- { .name = "uuid",
- .fops = &osp_uuid_fops },
{ .name = "ping",
.fops = &osp_ping_fops,
.proc_mode = 0222 },
};
static struct lprocfs_vars lprocfs_osp_md_vars[] = {
- { .name = "uuid",
- .fops = &osp_uuid_fops },
{ .name = "ping",
.fops = &osp_ping_fops,
.proc_mode = 0222 },
obd->obd_vars = lprocfs_osp_md_vars;
else
obd->obd_vars = lprocfs_osp_obd_vars;
- if (lprocfs_obd_setup(obd) != 0)
+ if (lprocfs_obd_setup(obd, true) != 0)
return;
rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars,
RETURN(rc);
}
- if (lprocfs_obd_setup(lwp->lpd_obd) == 0) {
- sptlrpc_lprocfs_cliobd_attach(lwp->lpd_obd);
- ptlrpc_lprocfs_register_obd(lwp->lpd_obd);
+ rc = lprocfs_obd_setup(lwp->lpd_obd, true);
+ if (rc) {
+ CERROR("%s: lprocfs_obd_setup failed. %d\n",
+ lwp->lpd_obd->obd_name, rc);
+ ptlrpcd_decref();
+ RETURN(rc);
}
+ rc = sptlrpc_lprocfs_cliobd_attach(lwp->lpd_obd);
+ if (rc) {
+ CERROR("%s: sptlrpc_lprocfs_cliobd_attached failed. %d\n",
+ lwp->lpd_obd->obd_name, rc);
+ ptlrpcd_decref();
+ RETURN(rc);
+ }
+
+ ptlrpc_lprocfs_register_obd(lwp->lpd_obd);
+
RETURN(0);
}
static struct cfs_cpt_table *ost_io_cptable;
-#ifdef CONFIG_PROC_FS
-LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
-
-static struct lprocfs_vars lprocfs_ost_obd_vars[] = {
- { .name = "uuid",
- .fops = &ost_uuid_fops },
- { NULL }
-};
-#endif /* CONFIG_PROC_FS */
-
/* Sigh - really, this is an OSS, the _server_, not the _target_ */
static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
{
int rc;
ENTRY;
-#ifdef CONFIG_PROC_FS
- obd->obd_vars = lprocfs_ost_obd_vars;
- lprocfs_obd_setup(obd);
-#endif
+ lprocfs_obd_setup(obd, true);
+
mutex_init(&ost->ost_health_mutex);
svc_conf = (typeof(svc_conf)) {