|
@@ -1814,19 +1814,19 @@ int __init nfs_init_writepagecache(void)
|
|
nfs_wdata_mempool = mempool_create_slab_pool(MIN_POOL_WRITE,
|
|
nfs_wdata_mempool = mempool_create_slab_pool(MIN_POOL_WRITE,
|
|
nfs_wdata_cachep);
|
|
nfs_wdata_cachep);
|
|
if (nfs_wdata_mempool == NULL)
|
|
if (nfs_wdata_mempool == NULL)
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ goto out_destroy_write_cache;
|
|
|
|
|
|
nfs_cdata_cachep = kmem_cache_create("nfs_commit_data",
|
|
nfs_cdata_cachep = kmem_cache_create("nfs_commit_data",
|
|
sizeof(struct nfs_commit_data),
|
|
sizeof(struct nfs_commit_data),
|
|
0, SLAB_HWCACHE_ALIGN,
|
|
0, SLAB_HWCACHE_ALIGN,
|
|
NULL);
|
|
NULL);
|
|
if (nfs_cdata_cachep == NULL)
|
|
if (nfs_cdata_cachep == NULL)
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ goto out_destroy_write_mempool;
|
|
|
|
|
|
nfs_commit_mempool = mempool_create_slab_pool(MIN_POOL_COMMIT,
|
|
nfs_commit_mempool = mempool_create_slab_pool(MIN_POOL_COMMIT,
|
|
nfs_wdata_cachep);
|
|
nfs_wdata_cachep);
|
|
if (nfs_commit_mempool == NULL)
|
|
if (nfs_commit_mempool == NULL)
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ goto out_destroy_commit_cache;
|
|
|
|
|
|
/*
|
|
/*
|
|
* NFS congestion size, scale with available memory.
|
|
* NFS congestion size, scale with available memory.
|
|
@@ -1849,11 +1849,20 @@ int __init nfs_init_writepagecache(void)
|
|
nfs_congestion_kb = 256*1024;
|
|
nfs_congestion_kb = 256*1024;
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
|
+
|
|
|
|
+out_destroy_commit_cache:
|
|
|
|
+ kmem_cache_destroy(nfs_cdata_cachep);
|
|
|
|
+out_destroy_write_mempool:
|
|
|
|
+ mempool_destroy(nfs_wdata_mempool);
|
|
|
|
+out_destroy_write_cache:
|
|
|
|
+ kmem_cache_destroy(nfs_wdata_cachep);
|
|
|
|
+ return -ENOMEM;
|
|
}
|
|
}
|
|
|
|
|
|
void nfs_destroy_writepagecache(void)
|
|
void nfs_destroy_writepagecache(void)
|
|
{
|
|
{
|
|
mempool_destroy(nfs_commit_mempool);
|
|
mempool_destroy(nfs_commit_mempool);
|
|
|
|
+ kmem_cache_destroy(nfs_cdata_cachep);
|
|
mempool_destroy(nfs_wdata_mempool);
|
|
mempool_destroy(nfs_wdata_mempool);
|
|
kmem_cache_destroy(nfs_wdata_cachep);
|
|
kmem_cache_destroy(nfs_wdata_cachep);
|
|
}
|
|
}
|