@@ -371,9 +371,13 @@ static struct kmem_cache *cifs_inode_cachep;
371
371
static struct kmem_cache * cifs_req_cachep ;
372
372
static struct kmem_cache * cifs_mid_cachep ;
373
373
static struct kmem_cache * cifs_sm_req_cachep ;
374
+ static struct kmem_cache * cifs_io_request_cachep ;
375
+ static struct kmem_cache * cifs_io_subrequest_cachep ;
374
376
mempool_t * cifs_sm_req_poolp ;
375
377
mempool_t * cifs_req_poolp ;
376
378
mempool_t * cifs_mid_poolp ;
379
+ mempool_t cifs_io_request_pool ;
380
+ mempool_t cifs_io_subrequest_pool ;
377
381
378
382
static struct inode *
379
383
cifs_alloc_inode (struct super_block * sb )
@@ -1750,6 +1754,48 @@ static void destroy_mids(void)
1750
1754
kmem_cache_destroy (cifs_mid_cachep );
1751
1755
}
1752
1756
1757
+ static int cifs_init_netfs (void )
1758
+ {
1759
+ cifs_io_request_cachep =
1760
+ kmem_cache_create ("cifs_io_request" ,
1761
+ sizeof (struct netfs_io_request ), 0 ,
1762
+ SLAB_HWCACHE_ALIGN , NULL );
1763
+ if (!cifs_io_request_cachep )
1764
+ goto nomem_req ;
1765
+
1766
+ if (mempool_init_slab_pool (& cifs_io_request_pool , 100 , cifs_io_request_cachep ) < 0 )
1767
+ goto nomem_reqpool ;
1768
+
1769
+ cifs_io_subrequest_cachep =
1770
+ kmem_cache_create ("cifs_io_subrequest" ,
1771
+ sizeof (struct cifs_io_subrequest ), 0 ,
1772
+ SLAB_HWCACHE_ALIGN , NULL );
1773
+ if (!cifs_io_subrequest_cachep )
1774
+ goto nomem_subreq ;
1775
+
1776
+ if (mempool_init_slab_pool (& cifs_io_subrequest_pool , 100 , cifs_io_subrequest_cachep ) < 0 )
1777
+ goto nomem_subreqpool ;
1778
+
1779
+ return 0 ;
1780
+
1781
+ nomem_subreqpool :
1782
+ kmem_cache_destroy (cifs_io_subrequest_cachep );
1783
+ nomem_subreq :
1784
+ mempool_destroy (& cifs_io_request_pool );
1785
+ nomem_reqpool :
1786
+ kmem_cache_destroy (cifs_io_request_cachep );
1787
+ nomem_req :
1788
+ return - ENOMEM ;
1789
+ }
1790
+
1791
+ static void cifs_destroy_netfs (void )
1792
+ {
1793
+ mempool_destroy (& cifs_io_subrequest_pool );
1794
+ kmem_cache_destroy (cifs_io_subrequest_cachep );
1795
+ mempool_destroy (& cifs_io_request_pool );
1796
+ kmem_cache_destroy (cifs_io_request_cachep );
1797
+ }
1798
+
1753
1799
static int __init
1754
1800
init_cifs (void )
1755
1801
{
@@ -1854,10 +1900,14 @@ init_cifs(void)
1854
1900
if (rc )
1855
1901
goto out_destroy_deferredclose_wq ;
1856
1902
1857
- rc = init_mids ();
1903
+ rc = cifs_init_netfs ();
1858
1904
if (rc )
1859
1905
goto out_destroy_inodecache ;
1860
1906
1907
+ rc = init_mids ();
1908
+ if (rc )
1909
+ goto out_destroy_netfs ;
1910
+
1861
1911
rc = cifs_init_request_bufs ();
1862
1912
if (rc )
1863
1913
goto out_destroy_mids ;
@@ -1912,6 +1962,8 @@ init_cifs(void)
1912
1962
cifs_destroy_request_bufs ();
1913
1963
out_destroy_mids :
1914
1964
destroy_mids ();
1965
+ out_destroy_netfs :
1966
+ cifs_destroy_netfs ();
1915
1967
out_destroy_inodecache :
1916
1968
cifs_destroy_inodecache ();
1917
1969
out_destroy_deferredclose_wq :
@@ -1950,6 +2002,7 @@ exit_cifs(void)
1950
2002
#endif
1951
2003
cifs_destroy_request_bufs ();
1952
2004
destroy_mids ();
2005
+ cifs_destroy_netfs ();
1953
2006
cifs_destroy_inodecache ();
1954
2007
destroy_workqueue (deferredclose_wq );
1955
2008
destroy_workqueue (cifsoplockd_wq );
0 commit comments