* \retval negative negative errno if get statfs failed.
*/
static int osp_statfs(const struct lu_env *env, struct dt_device *dev,
- struct obd_statfs *sfs)
+ struct obd_statfs *sfs, struct obd_statfs_info *info)
{
struct osp_device *d = dt2osp_dev(dev);
struct obd_import *imp = d->opd_obd->u.cli.cl_import;
/* return recently updated data */
*sfs = d->opd_statfs;
+ if (info) {
+ info->os_reserved_mb_low = d->opd_reserved_mb_low;
+ info->os_reserved_mb_high = d->opd_reserved_mb_high;
+ }
if (d->opd_pre == NULL)
RETURN(0);
+ CDEBUG(D_OTHER, "%s: %llu blocks, %llu free, %llu avail, "
+ "%u reserved mb low, %u reserved mb high,"
+ "%llu files, %llu free files\n", d->opd_obd->obd_name,
+ sfs->os_blocks, sfs->os_bfree, sfs->os_bavail,
+ d->opd_reserved_mb_low, d->opd_reserved_mb_high,
+ sfs->os_files, sfs->os_ffree);
+
+
+ if (info && !info->os_enable_pre)
+ RETURN(0);
+
/*
* layer above osp (usually lod) can use ffree to estimate
* how many objects are available for immediate creation
*/
spin_lock(&d->opd_pre_lock);
- LASSERTF(fid_seq(&d->opd_pre_last_created_fid) ==
- fid_seq(&d->opd_pre_used_fid),
- "last_created "DFID", next_fid "DFID"\n",
- PFID(&d->opd_pre_last_created_fid),
- PFID(&d->opd_pre_used_fid));
- sfs->os_fprecreated = fid_oid(&d->opd_pre_last_created_fid) -
- fid_oid(&d->opd_pre_used_fid);
+ sfs->os_fprecreated = osp_fid_diff(&d->opd_pre_last_created_fid,
+ &d->opd_pre_used_fid);
sfs->os_fprecreated -= d->opd_pre_reserved;
LASSERTF(sfs->os_fprecreated <= OST_MAX_PRECREATE * 2,
"last_created "DFID", next_fid "DFID", reserved %llu\n",
PFID(&d->opd_pre_last_created_fid), PFID(&d->opd_pre_used_fid),
d->opd_pre_reserved);
spin_unlock(&d->opd_pre_lock);
-
- CDEBUG(D_OTHER, "%s: %llu blocks, %llu free, %llu avail, "
- "%llu files, %llu free files\n", d->opd_obd->obd_name,
- sfs->os_blocks, sfs->os_bfree, sfs->os_bavail,
- sfs->os_files, sfs->os_ffree);
RETURN(0);
}
if (rc != 0)
GOTO(out, rc);
- CDEBUG(D_CACHE, "%s: processed %lu\n", d->opd_obd->obd_name,
- atomic64_read(&d->opd_sync_processed_recs));
+ CDEBUG(D_CACHE, "%s: processed %llu\n", d->opd_obd->obd_name,
+ (unsigned long long)atomic64_read(&d->opd_sync_processed_recs));
while (atomic64_read(&d->opd_sync_processed_recs) < old + recs) {
__u64 last = atomic64_read(&d->opd_sync_processed_recs);
{
struct obd_device *obd;
struct obd_import *imp;
- class_uuid_t uuid;
char *src, *tgt, *mdt, *osdname = NULL;
int rc;
long idx;
/*
* Initiate connect to OST
*/
- ll_generate_random_uuid(uuid);
- class_uuid_unparse(uuid, &osp->opd_cluuid);
-
imp = obd->u.cli.cl_import;
rc = ptlrpc_init_import(imp);
}
LASSERT(osp->opd_obd);
- osp_tunables_fini(osp);
rc = client_obd_cleanup(osp->opd_obd);
if (rc != 0) {
RETURN(ERR_PTR(rc));
}
+ osp_tunables_fini(osp);
+
ptlrpcd_decref();
RETURN(NULL);
.o_fid_alloc = osp_fid_alloc,
};
-static struct obd_type sym;
+static struct obd_type *sym;
/**
* Initialize OSP module.
*/
static int __init osp_init(void)
{
- struct dentry *symlink;
- struct obd_type *type;
- struct kobject *kobj;
- struct qstr dname;
int rc;
rc = lu_kmem_init(osp_caches);
if (rc)
return rc;
- rc = class_register_type(&osp_obd_device_ops, NULL, true, NULL,
+ rc = class_register_type(&osp_obd_device_ops, NULL, false, NULL,
LUSTRE_OSP_NAME, &osp_device_type);
if (rc != 0) {
lu_kmem_fini(osp_caches);
}
/* create "osc" entry for compatibility purposes */
- dname.name = "osc";
- 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_osc, 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;
+ sym = class_add_symlinks(LUSTRE_OSC_NAME, false);
+ if (IS_ERR(sym)) {
+ rc = PTR_ERR(sym);
+ /* does real "osc" already exist ? */
+ if (rc == -EEXIST)
+ rc = 0;
}
- 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_osc, rc);
- }
- sym.typ_kobj = kobj;
-
-try_proc:
- type = class_search_type(LUSTRE_OSC_NAME);
- if (type != NULL && type->typ_procroot != NULL)
- GOTO(no_osc, rc);
-
- type = class_search_type(LUSTRE_OSP_NAME);
- type->typ_procsym = lprocfs_register("osc", proc_lustre_root,
- NULL, NULL);
- if (IS_ERR(type->typ_procsym)) {
- CERROR("osp: can't create compat entry \"osc\": %d\n",
- (int) PTR_ERR(type->typ_procsym));
- type->typ_procsym = NULL;
- }
-no_osc:
return rc;
}
*/
static void __exit osp_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_LWP_NAME);
class_unregister_type(LUSTRE_OSP_NAME);
lu_kmem_fini(osp_caches);