From 27b7d73a801f8d7ada28b0510e3f6bbe633290d3 Mon Sep 17 00:00:00 2001 From: Serapheim Dimitropoulos Date: Fri, 18 Oct 2019 10:25:44 -0700 Subject: [PATCH] Name anonymous enum of KMC_BIT constants Giving a name to this enum makes it discoverable from debugging tools like DRGN and SDB. For example, with the name proposed on this patch we can iterate over these values in DRGN: ``` >>> prog.type('enum kmc_bit').enumerators (('KMC_BIT_NOTOUCH', 0), ('KMC_BIT_NODEBUG', 1), ('KMC_BIT_NOMAGAZINE', 2), ('KMC_BIT_NOHASH', 3), ('KMC_BIT_QCACHE', 4), ('KMC_BIT_KMEM', 5), ('KMC_BIT_VMEM', 6), ('KMC_BIT_SLAB', 7), ... ``` This enables SDB to easily pretty-print the flags of the spl_kmem_caches in the system like this: ``` > spl_kmem_caches -o "name,flags,total_memory" name flags total_memory ------------------------ ----------------------- ------------ abd_t KMC_NOMAGAZINE|KMC_SLAB 4.5MB arc_buf_hdr_t_full KMC_NOMAGAZINE|KMC_SLAB 12.3MB ... ... ddt_cache KMC_VMEM 583.7KB ddt_entry_cache KMC_NOMAGAZINE|KMC_SLAB 0.0B ... ... zio_buf_1048576 KMC_NODEBUG|KMC_VMEM 0.0B ... ... ``` Reviewed-by: Matt Ahrens Reviewed-by: Brian Behlendorf Signed-off-by: Serapheim Dimitropoulos Closes #9478 --- include/spl/sys/kmem_cache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spl/sys/kmem_cache.h b/include/spl/sys/kmem_cache.h index 4ee7bcae07e7..8381b03d8ec2 100644 --- a/include/spl/sys/kmem_cache.h +++ b/include/spl/sys/kmem_cache.h @@ -35,7 +35,7 @@ * size. This slab implementation also supports both constructors and * destructors which the Linux slab does not. */ -enum { +typedef enum kmc_bit { KMC_BIT_NOTOUCH = 0, /* Don't update ages */ KMC_BIT_NODEBUG = 1, /* Default behavior */ KMC_BIT_NOMAGAZINE = 2, /* XXX: Unsupported */ @@ -52,7 +52,7 @@ enum { KMC_BIT_TOTAL = 18, /* Proc handler helper bit */ KMC_BIT_ALLOC = 19, /* Proc handler helper bit */ KMC_BIT_MAX = 20, /* Proc handler helper bit */ -}; +} kmc_bit_t; /* kmem move callback return values */ typedef enum kmem_cbrc {