From 723c8bb6bd447c9c3faa1f858be9fc915582f629 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Mon, 3 Nov 2014 09:35:42 -0500 Subject: [PATCH] Retire kmem_virt() The initial port of ZFS to Linux required a way to identify virtual memory to make IO to virtual memory backed slabs work, so kmem_virt() was created. Linux 2.6.25 introduced is_vmalloc_addr(), which is logically equivalent to kmem_virt(). Support for kernels before 2.6.26 was later dropped and more recently, support for kernels before Linux 2.6.32 has been dropped. We retire kmem_virt() in favor of is_vmalloc_addr() to cleanup the code. Signed-off-by: Richard Yao --- include/sys/kmem.h | 2 -- module/spl/spl-kmem.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/sys/kmem.h b/include/sys/kmem.h index 60ff8273..7115734d 100644 --- a/include/sys/kmem.h +++ b/include/sys/kmem.h @@ -402,8 +402,6 @@ void spl_kmem_fini(void); #define kmem_cache_reap_now(skc) \ spl_kmem_cache_reap_now(skc, skc->skc_reap) #define kmem_reap() spl_kmem_reap() -#define kmem_virt(ptr) (((ptr) >= (void *)VMALLOC_START) && \ - ((ptr) < (void *)VMALLOC_END)) /* * Allow custom slab allocation flags to be set for KMC_SLAB based caches. diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 2aa54fdf..e8292426 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -1976,7 +1976,7 @@ spl_kmem_cache_free(spl_kmem_cache_t *skc, void *obj) * are guaranteed to have physical addresses. They must be removed * from the tree of emergency objects and the freed. */ - if ((skc->skc_flags & KMC_VMEM) && !kmem_virt(obj)) + if ((skc->skc_flags & KMC_VMEM) && !is_vmalloc_addr(obj)) SGOTO(out, spl_emergency_free(skc, obj)); local_irq_save(flags);