2121#include "filecache.h"
2222#include "trace.h"
2323
24- #define NFSDDBG_FACILITY NFSDDBG_FH
25-
26- /* FIXME: dynamically size this for the machine somehow? */
27- #define NFSD_FILE_HASH_BITS 12
28- #define NFSD_FILE_HASH_SIZE (1 << NFSD_FILE_HASH_BITS)
2924#define NFSD_LAUNDRETTE_DELAY (2 * HZ)
3025
3126#define NFSD_FILE_CACHE_UP (0)
3227
3328/* We only care about NFSD_MAY_READ/WRITE for this cache */
3429#define NFSD_FILE_MAY_MASK (NFSD_MAY_READ|NFSD_MAY_WRITE)
3530
36- struct nfsd_fcache_bucket {
37- struct hlist_head nfb_head ;
38- spinlock_t nfb_lock ;
39- unsigned int nfb_count ;
40- unsigned int nfb_maxcount ;
41- };
42-
4331static DEFINE_PER_CPU (unsigned long, nfsd_file_cache_hits ) ;
4432static DEFINE_PER_CPU (unsigned long, nfsd_file_acquisitions ) ;
4533static DEFINE_PER_CPU (unsigned long, nfsd_file_releases ) ;
@@ -57,7 +45,6 @@ static struct workqueue_struct *nfsd_filecache_wq __read_mostly;
5745
5846static struct kmem_cache * nfsd_file_slab ;
5947static struct kmem_cache * nfsd_file_mark_slab ;
60- static struct nfsd_fcache_bucket * nfsd_file_hashtbl ;
6148static struct list_lru nfsd_file_lru ;
6249static unsigned long nfsd_file_flags ;
6350static struct fsnotify_group * nfsd_file_fsnotify_group ;
@@ -302,7 +289,6 @@ nfsd_file_alloc(struct nfsd_file_lookup_key *key, unsigned int may)
302289
303290 nf = kmem_cache_alloc (nfsd_file_slab , GFP_KERNEL );
304291 if (nf ) {
305- INIT_HLIST_NODE (& nf -> nf_node );
306292 INIT_LIST_HEAD (& nf -> nf_lru );
307293 nf -> nf_birthtime = ktime_get ();
308294 nf -> nf_file = NULL ;
@@ -810,8 +796,7 @@ static const struct fsnotify_ops nfsd_file_fsnotify_ops = {
810796int
811797nfsd_file_cache_init (void )
812798{
813- int ret ;
814- unsigned int i ;
799+ int ret ;
815800
816801 lockdep_assert_held (& nfsd_mutex );
817802 if (test_and_set_bit (NFSD_FILE_CACHE_UP , & nfsd_file_flags ) == 1 )
@@ -826,13 +811,6 @@ nfsd_file_cache_init(void)
826811 if (!nfsd_filecache_wq )
827812 goto out ;
828813
829- nfsd_file_hashtbl = kvcalloc (NFSD_FILE_HASH_SIZE ,
830- sizeof (* nfsd_file_hashtbl ), GFP_KERNEL );
831- if (!nfsd_file_hashtbl ) {
832- pr_err ("nfsd: unable to allocate nfsd_file_hashtbl\n" );
833- goto out_err ;
834- }
835-
836814 nfsd_file_slab = kmem_cache_create ("nfsd_file" ,
837815 sizeof (struct nfsd_file ), 0 , 0 , NULL );
838816 if (!nfsd_file_slab ) {
@@ -876,11 +854,6 @@ nfsd_file_cache_init(void)
876854 goto out_notifier ;
877855 }
878856
879- for (i = 0 ; i < NFSD_FILE_HASH_SIZE ; i ++ ) {
880- INIT_HLIST_HEAD (& nfsd_file_hashtbl [i ].nfb_head );
881- spin_lock_init (& nfsd_file_hashtbl [i ].nfb_lock );
882- }
883-
884857 INIT_DELAYED_WORK (& nfsd_filecache_laundrette , nfsd_file_gc_worker );
885858out :
886859 return ret ;
@@ -895,8 +868,6 @@ nfsd_file_cache_init(void)
895868 nfsd_file_slab = NULL ;
896869 kmem_cache_destroy (nfsd_file_mark_slab );
897870 nfsd_file_mark_slab = NULL ;
898- kvfree (nfsd_file_hashtbl );
899- nfsd_file_hashtbl = NULL ;
900871 destroy_workqueue (nfsd_filecache_wq );
901872 nfsd_filecache_wq = NULL ;
902873 rhashtable_destroy (& nfsd_file_rhash_tbl );
@@ -1026,8 +997,6 @@ nfsd_file_cache_shutdown(void)
1026997 fsnotify_wait_marks_destroyed ();
1027998 kmem_cache_destroy (nfsd_file_mark_slab );
1028999 nfsd_file_mark_slab = NULL ;
1029- kvfree (nfsd_file_hashtbl );
1030- nfsd_file_hashtbl = NULL ;
10311000 destroy_workqueue (nfsd_filecache_wq );
10321001 nfsd_filecache_wq = NULL ;
10331002 rhashtable_destroy (& nfsd_file_rhash_tbl );
0 commit comments