From c6f2b942bee8bb31bbd41121b7d29984ed72539f Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Thu, 30 Jul 2020 13:56:00 -0700 Subject: [PATCH] Remove KMC_NOMAGAZINE Remove dead code to make the implementation easier to understand. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Matt Ahrens Closes #10650 --- include/os/linux/spl/sys/kmem_cache.h | 2 -- lib/libspl/include/umem.h | 1 - module/os/linux/spl/spl-kmem-cache.c | 10 ++-------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/include/os/linux/spl/sys/kmem_cache.h b/include/os/linux/spl/sys/kmem_cache.h index a659df8ed5..c9fc1f7499 100644 --- a/include/os/linux/spl/sys/kmem_cache.h +++ b/include/os/linux/spl/sys/kmem_cache.h @@ -37,7 +37,6 @@ */ typedef enum kmc_bit { KMC_BIT_NODEBUG = 1, /* Default behavior */ - KMC_BIT_NOMAGAZINE = 2, /* XXX: Unsupported */ KMC_BIT_KMEM = 5, /* Use kmem cache */ KMC_BIT_VMEM = 6, /* Use vmem cache */ KMC_BIT_KVMEM = 7, /* Use kvmalloc linux allocator */ @@ -61,7 +60,6 @@ typedef enum kmem_cbrc { } kmem_cbrc_t; #define KMC_NODEBUG (1 << KMC_BIT_NODEBUG) -#define KMC_NOMAGAZINE (1 << KMC_BIT_NOMAGAZINE) #define KMC_KMEM (1 << KMC_BIT_KMEM) #define KMC_VMEM (1 << KMC_BIT_VMEM) #define KMC_KVMEM (1 << KMC_BIT_KVMEM) diff --git a/lib/libspl/include/umem.h b/lib/libspl/include/umem.h index b6ea3b93ab..65f12595e6 100644 --- a/lib/libspl/include/umem.h +++ b/lib/libspl/include/umem.h @@ -58,7 +58,6 @@ typedef void vmem_t; * Flags for umem_cache_create() */ #define UMC_NODEBUG 0x00020000 -#define UMC_NOMAGAZINE 0x00040000 #define UMEM_CACHE_NAMELEN 31 diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index d3afcd54dd..5d1229b30a 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -662,8 +662,7 @@ spl_magazine_create(spl_kmem_cache_t *skc) { int i = 0; - if (skc->skc_flags & KMC_NOMAGAZINE) - return (0); + ASSERT((skc->skc_flags & KMC_SLAB) == 0); skc->skc_mag = kzalloc(sizeof (spl_kmem_magazine_t *) * num_possible_cpus(), kmem_flags_convert(KM_SLEEP)); @@ -693,8 +692,7 @@ spl_magazine_destroy(spl_kmem_cache_t *skc) spl_kmem_magazine_t *skm; int i = 0; - if (skc->skc_flags & KMC_NOMAGAZINE) - return; + ASSERT((skc->skc_flags & KMC_SLAB) == 0); for_each_possible_cpu(i) { skm = skc->skc_mag[i]; @@ -721,7 +719,6 @@ spl_magazine_destroy(spl_kmem_cache_t *skc) * KMC_KVMEM Force kvmem backed SPL cache * KMC_SLAB Force Linux slab backed cache * KMC_NODEBUG Disable debugging (unsupported) - * KMC_NOMAGAZINE Enabled for kmem/vmem, Disabled for Linux slab */ spl_kmem_cache_t * spl_kmem_cache_create(char *name, size_t size, size_t align, @@ -735,7 +732,6 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, /* * Unsupported flags */ - ASSERT0(flags & KMC_NOMAGAZINE); ASSERT(vmp == NULL); ASSERT(reclaim == NULL); @@ -872,8 +868,6 @@ spl_kmem_cache_create(char *name, size_t size, size_t align, rc = ENOMEM; goto out; } - - skc->skc_flags |= KMC_NOMAGAZINE; } down_write(&spl_kmem_cache_sem);