cifs: Add mempools for cifs_io_request and cifs_io_subrequest structs
Add mempools for the allocation of cifs_io_request and cifs_io_subrequest structs for netfslib to use so that it can guarantee eventual allocation in writeback. Signed-off-by: David Howells <dhowells@redhat.com> cc: Steve French <sfrench@samba.org> cc: Shyam Prasad N <nspmangalore@gmail.com> cc: Rohith Surabattula <rohiths.msft@gmail.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
This commit is contained in:
parent
3758c485f6
commit
edea94a697
2 changed files with 56 additions and 1 deletions
|
@ -371,9 +371,13 @@ static struct kmem_cache *cifs_inode_cachep;
|
||||||
static struct kmem_cache *cifs_req_cachep;
|
static struct kmem_cache *cifs_req_cachep;
|
||||||
static struct kmem_cache *cifs_mid_cachep;
|
static struct kmem_cache *cifs_mid_cachep;
|
||||||
static struct kmem_cache *cifs_sm_req_cachep;
|
static struct kmem_cache *cifs_sm_req_cachep;
|
||||||
|
static struct kmem_cache *cifs_io_request_cachep;
|
||||||
|
static struct kmem_cache *cifs_io_subrequest_cachep;
|
||||||
mempool_t *cifs_sm_req_poolp;
|
mempool_t *cifs_sm_req_poolp;
|
||||||
mempool_t *cifs_req_poolp;
|
mempool_t *cifs_req_poolp;
|
||||||
mempool_t *cifs_mid_poolp;
|
mempool_t *cifs_mid_poolp;
|
||||||
|
mempool_t cifs_io_request_pool;
|
||||||
|
mempool_t cifs_io_subrequest_pool;
|
||||||
|
|
||||||
static struct inode *
|
static struct inode *
|
||||||
cifs_alloc_inode(struct super_block *sb)
|
cifs_alloc_inode(struct super_block *sb)
|
||||||
|
@ -1750,6 +1754,48 @@ static void destroy_mids(void)
|
||||||
kmem_cache_destroy(cifs_mid_cachep);
|
kmem_cache_destroy(cifs_mid_cachep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cifs_init_netfs(void)
|
||||||
|
{
|
||||||
|
cifs_io_request_cachep =
|
||||||
|
kmem_cache_create("cifs_io_request",
|
||||||
|
sizeof(struct netfs_io_request), 0,
|
||||||
|
SLAB_HWCACHE_ALIGN, NULL);
|
||||||
|
if (!cifs_io_request_cachep)
|
||||||
|
goto nomem_req;
|
||||||
|
|
||||||
|
if (mempool_init_slab_pool(&cifs_io_request_pool, 100, cifs_io_request_cachep) < 0)
|
||||||
|
goto nomem_reqpool;
|
||||||
|
|
||||||
|
cifs_io_subrequest_cachep =
|
||||||
|
kmem_cache_create("cifs_io_subrequest",
|
||||||
|
sizeof(struct cifs_io_subrequest), 0,
|
||||||
|
SLAB_HWCACHE_ALIGN, NULL);
|
||||||
|
if (!cifs_io_subrequest_cachep)
|
||||||
|
goto nomem_subreq;
|
||||||
|
|
||||||
|
if (mempool_init_slab_pool(&cifs_io_subrequest_pool, 100, cifs_io_subrequest_cachep) < 0)
|
||||||
|
goto nomem_subreqpool;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
nomem_subreqpool:
|
||||||
|
kmem_cache_destroy(cifs_io_subrequest_cachep);
|
||||||
|
nomem_subreq:
|
||||||
|
mempool_destroy(&cifs_io_request_pool);
|
||||||
|
nomem_reqpool:
|
||||||
|
kmem_cache_destroy(cifs_io_request_cachep);
|
||||||
|
nomem_req:
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cifs_destroy_netfs(void)
|
||||||
|
{
|
||||||
|
mempool_destroy(&cifs_io_subrequest_pool);
|
||||||
|
kmem_cache_destroy(cifs_io_subrequest_cachep);
|
||||||
|
mempool_destroy(&cifs_io_request_pool);
|
||||||
|
kmem_cache_destroy(cifs_io_request_cachep);
|
||||||
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
init_cifs(void)
|
init_cifs(void)
|
||||||
{
|
{
|
||||||
|
@ -1854,10 +1900,14 @@ init_cifs(void)
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_destroy_deferredclose_wq;
|
goto out_destroy_deferredclose_wq;
|
||||||
|
|
||||||
rc = init_mids();
|
rc = cifs_init_netfs();
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_destroy_inodecache;
|
goto out_destroy_inodecache;
|
||||||
|
|
||||||
|
rc = init_mids();
|
||||||
|
if (rc)
|
||||||
|
goto out_destroy_netfs;
|
||||||
|
|
||||||
rc = cifs_init_request_bufs();
|
rc = cifs_init_request_bufs();
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_destroy_mids;
|
goto out_destroy_mids;
|
||||||
|
@ -1912,6 +1962,8 @@ out_destroy_request_bufs:
|
||||||
cifs_destroy_request_bufs();
|
cifs_destroy_request_bufs();
|
||||||
out_destroy_mids:
|
out_destroy_mids:
|
||||||
destroy_mids();
|
destroy_mids();
|
||||||
|
out_destroy_netfs:
|
||||||
|
cifs_destroy_netfs();
|
||||||
out_destroy_inodecache:
|
out_destroy_inodecache:
|
||||||
cifs_destroy_inodecache();
|
cifs_destroy_inodecache();
|
||||||
out_destroy_deferredclose_wq:
|
out_destroy_deferredclose_wq:
|
||||||
|
@ -1950,6 +2002,7 @@ exit_cifs(void)
|
||||||
#endif
|
#endif
|
||||||
cifs_destroy_request_bufs();
|
cifs_destroy_request_bufs();
|
||||||
destroy_mids();
|
destroy_mids();
|
||||||
|
cifs_destroy_netfs();
|
||||||
cifs_destroy_inodecache();
|
cifs_destroy_inodecache();
|
||||||
destroy_workqueue(deferredclose_wq);
|
destroy_workqueue(deferredclose_wq);
|
||||||
destroy_workqueue(cifsoplockd_wq);
|
destroy_workqueue(cifsoplockd_wq);
|
||||||
|
|
|
@ -2094,6 +2094,8 @@ extern __u32 cifs_lock_secret;
|
||||||
extern mempool_t *cifs_sm_req_poolp;
|
extern mempool_t *cifs_sm_req_poolp;
|
||||||
extern mempool_t *cifs_req_poolp;
|
extern mempool_t *cifs_req_poolp;
|
||||||
extern mempool_t *cifs_mid_poolp;
|
extern mempool_t *cifs_mid_poolp;
|
||||||
|
extern mempool_t cifs_io_request_pool;
|
||||||
|
extern mempool_t cifs_io_subrequest_pool;
|
||||||
|
|
||||||
/* Operations for different SMB versions */
|
/* Operations for different SMB versions */
|
||||||
#define SMB1_VERSION_STRING "1.0"
|
#define SMB1_VERSION_STRING "1.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue