NFSD: Clean up unused code after rhashtable conversion
authorChuck Lever <chuck.lever@oracle.com>
Fri, 8 Jul 2022 18:26:36 +0000 (14:26 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 30 Jul 2022 00:15:38 +0000 (20:15 -0400)
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c
fs/nfsd/filecache.h

index aed3cb6..bfa4df7 100644 (file)
 #include "filecache.h"
 #include "trace.h"
 
-#define NFSDDBG_FACILITY       NFSDDBG_FH
-
-/* FIXME: dynamically size this for the machine somehow? */
-#define NFSD_FILE_HASH_BITS                   12
-#define NFSD_FILE_HASH_SIZE                  (1 << NFSD_FILE_HASH_BITS)
 #define NFSD_LAUNDRETTE_DELAY               (2 * HZ)
 
 #define NFSD_FILE_CACHE_UP                  (0)
 /* We only care about NFSD_MAY_READ/WRITE for this cache */
 #define NFSD_FILE_MAY_MASK     (NFSD_MAY_READ|NFSD_MAY_WRITE)
 
-struct nfsd_fcache_bucket {
-       struct hlist_head       nfb_head;
-       spinlock_t              nfb_lock;
-       unsigned int            nfb_count;
-       unsigned int            nfb_maxcount;
-};
-
 static DEFINE_PER_CPU(unsigned long, nfsd_file_cache_hits);
 static DEFINE_PER_CPU(unsigned long, nfsd_file_acquisitions);
 static DEFINE_PER_CPU(unsigned long, nfsd_file_releases);
@@ -58,7 +46,6 @@ static struct workqueue_struct *nfsd_filecache_wq __read_mostly;
 
 static struct kmem_cache               *nfsd_file_slab;
 static struct kmem_cache               *nfsd_file_mark_slab;
-static struct nfsd_fcache_bucket       *nfsd_file_hashtbl;
 static struct list_lru                 nfsd_file_lru;
 static unsigned long                   nfsd_file_flags;
 static struct fsnotify_group           *nfsd_file_fsnotify_group;
@@ -303,7 +290,6 @@ nfsd_file_alloc(struct nfsd_file_lookup_key *key, unsigned int may)
 
        nf = kmem_cache_alloc(nfsd_file_slab, GFP_KERNEL);
        if (nf) {
-               INIT_HLIST_NODE(&nf->nf_node);
                INIT_LIST_HEAD(&nf->nf_lru);
                nf->nf_birthtime = ktime_get();
                nf->nf_file = NULL;
@@ -811,8 +797,7 @@ static const struct fsnotify_ops nfsd_file_fsnotify_ops = {
 int
 nfsd_file_cache_init(void)
 {
-       int             ret;
-       unsigned int    i;
+       int ret;
 
        lockdep_assert_held(&nfsd_mutex);
        if (test_and_set_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags) == 1)
@@ -827,13 +812,6 @@ nfsd_file_cache_init(void)
        if (!nfsd_filecache_wq)
                goto out;
 
-       nfsd_file_hashtbl = kvcalloc(NFSD_FILE_HASH_SIZE,
-                               sizeof(*nfsd_file_hashtbl), GFP_KERNEL);
-       if (!nfsd_file_hashtbl) {
-               pr_err("nfsd: unable to allocate nfsd_file_hashtbl\n");
-               goto out_err;
-       }
-
        nfsd_file_slab = kmem_cache_create("nfsd_file",
                                sizeof(struct nfsd_file), 0, 0, NULL);
        if (!nfsd_file_slab) {
@@ -877,11 +855,6 @@ nfsd_file_cache_init(void)
                goto out_notifier;
        }
 
-       for (i = 0; i < NFSD_FILE_HASH_SIZE; i++) {
-               INIT_HLIST_HEAD(&nfsd_file_hashtbl[i].nfb_head);
-               spin_lock_init(&nfsd_file_hashtbl[i].nfb_lock);
-       }
-
        INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker);
 out:
        return ret;
@@ -896,8 +869,6 @@ out_err:
        nfsd_file_slab = NULL;
        kmem_cache_destroy(nfsd_file_mark_slab);
        nfsd_file_mark_slab = NULL;
-       kvfree(nfsd_file_hashtbl);
-       nfsd_file_hashtbl = NULL;
        destroy_workqueue(nfsd_filecache_wq);
        nfsd_filecache_wq = NULL;
        rhashtable_destroy(&nfsd_file_rhash_tbl);
@@ -1027,8 +998,6 @@ nfsd_file_cache_shutdown(void)
        fsnotify_wait_marks_destroyed();
        kmem_cache_destroy(nfsd_file_mark_slab);
        nfsd_file_mark_slab = NULL;
-       kvfree(nfsd_file_hashtbl);
-       nfsd_file_hashtbl = NULL;
        destroy_workqueue(nfsd_filecache_wq);
        nfsd_filecache_wq = NULL;
        rhashtable_destroy(&nfsd_file_rhash_tbl);
index 5cbfc61..ee9ed99 100644 (file)
@@ -30,7 +30,6 @@ struct nfsd_file_mark {
  */
 struct nfsd_file {
        struct rhash_head       nf_rhash;
-       struct hlist_node       nf_node;
        struct list_head        nf_lru;
        struct rcu_head         nf_rcu;
        struct file             *nf_file;