*
* see include/dt_object.h for the details.
*/
-static int lod_statfs(const struct lu_env *env,
- struct dt_device *dev, struct obd_statfs *sfs)
+static int lod_statfs(const struct lu_env *env, struct dt_device *dev,
+ struct obd_statfs *sfs, struct obd_statfs_info *info)
{
struct lod_device *lod = dt2lod_dev(dev);
struct lod_ost_desc *ost;
sfs->os_bfree = 0;
sfs->os_granted = 0;
}
- ost_files += sfs->os_files;
- ost_ffree += sfs->os_ffree;
+ ost_files += ost_sfs.os_files;
+ ost_ffree += ost_sfs.os_ffree;
ost_sfs.os_bavail += ost_sfs.os_granted;
lod_statfs_sum(sfs, &ost_sfs, &bs);
LASSERTF(bs == ost_sfs.os_bsize, "%d != %d\n",
.o_pool_del = lod_pool_del,
};
-static struct obd_type sym;
+static struct obd_type *sym;
static int __init lod_init(void)
{
- struct dentry *symlink;
- struct obd_type *type;
- struct kobject *kobj;
- struct qstr dname;
int rc;
rc = lu_kmem_init(lod_caches);
}
/* create "lov" entry for compatibility purposes */
- dname.name = "lov";
- dname.len = strlen(dname.name);
- dname.hash = ll_full_name_hash(debugfs_lustre_root, dname.name,
- dname.len);
- symlink = d_lookup(debugfs_lustre_root, &dname);
- if (!symlink) {
- symlink = debugfs_create_dir(dname.name, debugfs_lustre_root);
- if (IS_ERR_OR_NULL(symlink)) {
- rc = symlink ? PTR_ERR(symlink) : -ENOMEM;
- GOTO(no_lov, rc);
- }
- sym.typ_debugfs_entry = symlink;
- } else {
- dput(symlink);
- }
-
- kobj = kset_find_obj(lustre_kset, dname.name);
- if (kobj) {
- kobject_put(kobj);
- goto try_proc;
- }
-
- kobj = class_setup_tunables(dname.name);
- if (IS_ERR(kobj)) {
- rc = PTR_ERR(kobj);
- if (sym.typ_debugfs_entry)
- ldebugfs_remove(&sym.typ_debugfs_entry);
- GOTO(no_lov, rc);
+ sym = class_add_symlinks(LUSTRE_LOV_NAME, true);
+ if (IS_ERR(sym)) {
+ rc = PTR_ERR(sym);
+ /* does real "lov" already exist ? */
+ if (rc == -EEXIST)
+ rc = 0;
}
- sym.typ_kobj = kobj;
-
-try_proc:
- type = class_search_type(LUSTRE_LOV_NAME);
- if (type && type->typ_procroot)
- GOTO(no_lov, rc);
- type = class_search_type(LUSTRE_LOD_NAME);
- type->typ_procsym = lprocfs_register("lov", proc_lustre_root,
- NULL, NULL);
- if (IS_ERR(type->typ_procsym)) {
- CERROR("lod: can't create compat entry \"lov\": %d\n",
- (int)PTR_ERR(type->typ_procsym));
- type->typ_procsym = NULL;
- }
-no_lov:
return rc;
}
static void __exit lod_exit(void)
{
- ldebugfs_remove(&sym.typ_debugfs_entry);
- kobject_put(sym.typ_kobj);
+ if (!IS_ERR_OR_NULL(sym))
+ kobject_put(&sym->typ_kobj);
+
class_unregister_type(LUSTRE_LOD_NAME);
lu_kmem_fini(lod_caches);
}