From cbf448e125bd4d2d698151d9fc6fa43956017d80 Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Wed, 27 Jul 2016 22:37:08 +0900 Subject: [PATCH] Use default CPU_COUNT() function in DragonFlyBSD os/os.h has a default CPU_COUNT() inline function for those that are expected to have CPU_COUNT() macro, but not in certain versions. This seems to have been added for RHEL5 (or older?) and variants, but use this in os/os-dragonfly.h since it's essentially the same as its own fio_cpu_count() implementation. Signed-off-by: Tomohiro Kusumi Signed-off-by: Jens Axboe --- os/os-dragonfly.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h index d4a95799..c7998177 100644 --- a/os/os-dragonfly.h +++ b/os/os-dragonfly.h @@ -81,6 +81,9 @@ typedef cpumask_t os_cpu_mask_t; #define USCHED_GET_CPUMASK 5 #endif +/* No CPU_COUNT(), but use the default function defined in os/os.h */ +#define fio_cpu_count(mask) CPU_COUNT((mask)) + static inline int fio_cpuset_init(os_cpu_mask_t *mask) { CPUMASK_ASSZERO(*mask); @@ -110,17 +113,6 @@ static inline int fio_cpu_isset(os_cpu_mask_t *mask, int cpu) return 0; } -static inline int fio_cpu_count(os_cpu_mask_t *mask) -{ - int i, n = 0; - - for (i = 0; i < FIO_MAX_CPUS; i++) - if (CPUMASK_TESTBIT(*mask, i)) - n++; - - return n; -} - static inline int fio_setaffinity(int pid, os_cpu_mask_t mask) { int i, firstcall = 1; -- 2.25.1