Exemplo n.º 1
0
/*
 * 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;
}
Exemplo n.º 2
0
static int __init
init_cifs(void)
{
    int rc = 0;
    cifs_proc_init();
    INIT_LIST_HEAD(&cifs_tcp_ses_list);
#ifdef CONFIG_CIFS_EXPERIMENTAL
    INIT_LIST_HEAD(&GlobalDnotifyReqList);
    INIT_LIST_HEAD(&GlobalDnotifyRsp_Q);
#endif
    /*
     *  Initialize Global counters
     */
    atomic_set(&sesInfoAllocCount, 0);
    atomic_set(&tconInfoAllocCount, 0);
    atomic_set(&tcpSesAllocCount, 0);
    atomic_set(&tcpSesReconnectCount, 0);
    atomic_set(&tconInfoReconnectCount, 0);

    atomic_set(&bufAllocCount, 0);
    atomic_set(&smBufAllocCount, 0);
#ifdef CONFIG_CIFS_STATS2
    atomic_set(&totBufAllocCount, 0);
    atomic_set(&totSmBufAllocCount, 0);
#endif /* CONFIG_CIFS_STATS2 */

    atomic_set(&midCount, 0);
    GlobalCurrentXid = 0;
    GlobalTotalActiveXid = 0;
    GlobalMaxActiveXid = 0;
    memset(Local_System_Name, 0, 15);
    rwlock_init(&GlobalSMBSeslock);
    rwlock_init(&cifs_tcp_ses_lock);
    spin_lock_init(&GlobalMid_Lock);

    if (cifs_max_pending < 2) {
        cifs_max_pending = 2;
        cFYI(1, "cifs_max_pending set to min of 2");
    } else if (cifs_max_pending > 256) {
        cifs_max_pending = 256;
        cFYI(1, "cifs_max_pending set to max of 256");
    }

    rc = cifs_init_inodecache();
    if (rc)
        goto out_clean_proc;

    rc = cifs_init_mids();
    if (rc)
        goto out_destroy_inodecache;

    rc = cifs_init_request_bufs();
    if (rc)
        goto out_destroy_mids;

    rc = register_filesystem(&cifs_fs_type);
    if (rc)
        goto out_destroy_request_bufs;
#ifdef CONFIG_CIFS_UPCALL
    rc = register_key_type(&cifs_spnego_key_type);
    if (rc)
        goto out_unregister_filesystem;
#endif
#ifdef CONFIG_CIFS_DFS_UPCALL
    rc = register_key_type(&key_type_dns_resolver);
    if (rc)
        goto out_unregister_key_type;
#endif
    rc = slow_work_register_user(THIS_MODULE);
    if (rc)
        goto out_unregister_resolver_key;

    return 0;

out_unregister_resolver_key:
#ifdef CONFIG_CIFS_DFS_UPCALL
    unregister_key_type(&key_type_dns_resolver);
out_unregister_key_type:
#endif
#ifdef CONFIG_CIFS_UPCALL
    unregister_key_type(&cifs_spnego_key_type);
out_unregister_filesystem:
#endif
    unregister_filesystem(&cifs_fs_type);
out_destroy_request_bufs:
    cifs_destroy_request_bufs();
out_destroy_mids:
    cifs_destroy_mids();
out_destroy_inodecache:
    cifs_destroy_inodecache();
out_clean_proc:
    cifs_proc_clean();
    return rc;
}
Exemplo n.º 3
0
static int __init init_gfs2_fs(void)
{
	int error;

	error = gfs2_sys_init();
	if (error)
		return error;

	error = gfs2_glock_init();
	if (error)
		goto fail;

	error = -ENOMEM;
	gfs2_glock_cachep = kmem_cache_create("gfs2_glock",
					      sizeof(struct gfs2_glock),
					      0, 0,
					      gfs2_init_glock_once);
	if (!gfs2_glock_cachep)
		goto fail;

	gfs2_glock_aspace_cachep = kmem_cache_create("gfs2_glock(aspace)",
					sizeof(struct gfs2_glock) +
					sizeof(struct address_space),
					0, 0, gfs2_init_gl_aspace_once);

	if (!gfs2_glock_aspace_cachep)
		goto fail;

	gfs2_inode_cachep = kmem_cache_create("gfs2_inode",
					      sizeof(struct gfs2_inode),
					      0,  SLAB_RECLAIM_ACCOUNT|
					          SLAB_MEM_SPREAD,
					      gfs2_init_inode_once);
	if (!gfs2_inode_cachep)
		goto fail;

	gfs2_bufdata_cachep = kmem_cache_create("gfs2_bufdata",
						sizeof(struct gfs2_bufdata),
					        0, 0, NULL);
	if (!gfs2_bufdata_cachep)
		goto fail;

	gfs2_rgrpd_cachep = kmem_cache_create("gfs2_rgrpd",
					      sizeof(struct gfs2_rgrpd),
					      0, 0, NULL);
	if (!gfs2_rgrpd_cachep)
		goto fail;

	gfs2_quotad_cachep = kmem_cache_create("gfs2_quotad",
					       sizeof(struct gfs2_quota_data),
					       0, 0, NULL);
	if (!gfs2_quotad_cachep)
		goto fail;

	register_shrinker(&qd_shrinker);

	error = register_filesystem(&gfs2_fs_type);
	if (error)
		goto fail;

	error = register_filesystem(&gfs2meta_fs_type);
	if (error)
		goto fail_unregister;

	error = slow_work_register_user(THIS_MODULE);
	if (error)
		goto fail_slow;

	gfs2_register_debugfs();

	printk("GFS2 (built %s %s) installed\n", __DATE__, __TIME__);

	return 0;

fail_slow:
	unregister_filesystem(&gfs2meta_fs_type);
fail_unregister:
	unregister_filesystem(&gfs2_fs_type);
fail:
	unregister_shrinker(&qd_shrinker);
	gfs2_glock_exit();

	if (gfs2_quotad_cachep)
		kmem_cache_destroy(gfs2_quotad_cachep);

	if (gfs2_rgrpd_cachep)
		kmem_cache_destroy(gfs2_rgrpd_cachep);

	if (gfs2_bufdata_cachep)
		kmem_cache_destroy(gfs2_bufdata_cachep);

	if (gfs2_inode_cachep)
		kmem_cache_destroy(gfs2_inode_cachep);

	if (gfs2_glock_aspace_cachep)
		kmem_cache_destroy(gfs2_glock_aspace_cachep);

	if (gfs2_glock_cachep)
		kmem_cache_destroy(gfs2_glock_cachep);

	gfs2_sys_uninit();
	return error;
}