RETURN(0);
/*
- * layer above osp (usually lod) can use ffree to estimate
- * how many objects are available for immediate creation
+ * The layer above osp (usually lod) can use f_precreated to
+ * estimate how many objects are available for immediate usage.
*/
spin_lock(&d->opd_pre_lock);
sfs->os_fprecreated = osp_fid_diff(&d->opd_pre_last_created_fid,
.o_fid_alloc = osp_fid_alloc,
};
-static struct obd_type *sym;
-
/**
* Initialize OSP module.
*
*/
static int __init osp_init(void)
{
+ struct obd_type *sym;
int rc;
rc = lu_kmem_init(osp_caches);
}
/* create "osc" entry for compatibility purposes */
- sym = class_add_symlinks(LUSTRE_OSC_NAME, false);
+ sym = class_add_symlinks(LUSTRE_OSC_NAME, true);
if (IS_ERR(sym)) {
rc = PTR_ERR(sym);
/* does real "osc" already exist ? */
*/
static void __exit osp_exit(void)
{
- if (!IS_ERR_OR_NULL(sym))
+ struct obd_type *sym = class_search_type(LUSTRE_OSC_NAME);
+
+ /* if this was never fully initialized by the osc layer
+ * then we are responsible for freeing this obd_type
+ */
+ if (sym) {
+ /* final put if we manage this obd type */
+ if (sym->typ_sym_filter)
+ kobject_put(&sym->typ_kobj);
+ /* put reference taken by class_search_type */
kobject_put(&sym->typ_kobj);
+ }
class_unregister_type(LUSTRE_LWP_NAME);
class_unregister_type(LUSTRE_OSP_NAME);