/* * clean up on module removal */ static void __exit fscache_exit(void) { _enter(""); kobject_put(fscache_root); kmem_cache_destroy(fscache_cookie_jar); fscache_proc_cleanup(); slow_work_unregister_user(THIS_MODULE); printk(KERN_NOTICE "FS-Cache: Unloaded\n"); }
static void __exit exit_gfs2_fs(void) { unregister_shrinker(&qd_shrinker); gfs2_glock_exit(); gfs2_unregister_debugfs(); unregister_filesystem(&gfs2_fs_type); unregister_filesystem(&gfs2meta_fs_type); slow_work_unregister_user(); kmem_cache_destroy(gfs2_quotad_cachep); kmem_cache_destroy(gfs2_rgrpd_cachep); kmem_cache_destroy(gfs2_bufdata_cachep); kmem_cache_destroy(gfs2_inode_cachep); kmem_cache_destroy(gfs2_glock_cachep); gfs2_sys_uninit(); }
/* * initialise the fs caching module */ static int __init fscache_init(void) { int ret; mark_tech_preview(NULL, THIS_MODULE); ret = slow_work_register_user(THIS_MODULE); if (ret < 0) goto error_slow_work; ret = fscache_proc_init(); if (ret < 0) goto error_proc; fscache_cookie_jar = kmem_cache_create("fscache_cookie_jar", sizeof(struct fscache_cookie), 0, 0, fscache_cookie_init_once); if (!fscache_cookie_jar) { printk(KERN_NOTICE "FS-Cache: Failed to allocate a cookie jar\n"); ret = -ENOMEM; goto error_cookie_jar; } fscache_root = kobject_create_and_add("fscache", kernel_kobj); if (!fscache_root) goto error_kobj; printk(KERN_NOTICE "FS-Cache: Loaded\n"); return 0; error_kobj: kmem_cache_destroy(fscache_cookie_jar); error_cookie_jar: fscache_proc_cleanup(); error_proc: slow_work_unregister_user(THIS_MODULE); error_slow_work: return ret; }