Fix cpu mask setting
authorGough, Corey D <corey.d.gough@intel.com>
Wed, 13 Jun 2007 18:58:01 +0000 (20:58 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 13 Jun 2007 18:58:01 +0000 (20:58 +0200)
Fio passed the mask by value, not by reference. So when
fill_cpu_mask() was done setting the valid CPUs, it was
only on the local value.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
options.c

index e67742ddec211043e1bdceadeae9b0ed5f375282..839af0bffbdc5f3d4e2c5c6488ef6d7debadef4b 100644 (file)
--- a/options.c
+++ b/options.c
@@ -98,17 +98,16 @@ static int str_exitall_cb(void)
        return 0;
 }
 
-static void fill_cpu_mask(os_cpu_mask_t cpumask, int cpu)
+static void fill_cpu_mask(os_cpu_mask_t *cpumask, int cpu)
 {
 #ifdef FIO_HAVE_CPU_AFFINITY
        unsigned int i;
 
-       CPU_ZERO(&cpumask);
+       CPU_ZERO(cpumask);
 
-       for (i = 0; i < sizeof(int) * 8; i++) {
+       for (i = 0; i < sizeof(int) * 8; i++)
                if ((1 << i) & cpu)
-                       CPU_SET(i, &cpumask);
-       }
+                       CPU_SET(i, cpumask);
 #endif
 }
 
@@ -116,7 +115,7 @@ static int str_cpumask_cb(void *data, unsigned int *val)
 {
        struct thread_data *td = data;
 
-       fill_cpu_mask(td->o.cpumask, *val);
+       fill_cpu_mask(&td->o.cpumask, *val);
        td->o.cpumask_set = 1;
        return 0;
 }