Use default CPU_COUNT() function in DragonFlyBSD
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 27 Jul 2016 13:37:08 +0000 (22:37 +0900)
committerJens Axboe <axboe@fb.com>
Wed, 27 Jul 2016 14:29:45 +0000 (08:29 -0600)
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 <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
os/os-dragonfly.h

index d4a9579958ffcd16856b495e9fc79766f2feef69..c799817765675542b01e8bf93ff946c9a9a4729b 100644 (file)
@@ -81,6 +81,9 @@ typedef cpumask_t os_cpu_mask_t;
 #define USCHED_GET_CPUMASK     5
 #endif
 
 #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);
 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;
 }
 
        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;
 static inline int fio_setaffinity(int pid, os_cpu_mask_t mask)
 {
        int i, firstcall = 1;