Jens Axboe | 5116779 | 2012-03-08 21:34:18 +0100 | [diff] [blame] | 1 | #include <string.h> |
| 2 | |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 3 | #include "thread_options.h" |
| 4 | |
| 5 | static void string_to_cpu(char **dst, const uint8_t *src) |
| 6 | { |
| 7 | const char *__src = (const char *) src; |
| 8 | |
| 9 | if (strlen(__src)) |
| 10 | *dst = strdup(__src); |
| 11 | } |
| 12 | |
| 13 | static void string_to_net(uint8_t *dst, const char *src) |
| 14 | { |
| 15 | if (src) |
| 16 | strcpy((char *) dst, src); |
| 17 | else |
| 18 | dst[0] = '\0'; |
| 19 | } |
| 20 | |
| 21 | void convert_thread_options_to_cpu(struct thread_options *o, |
| 22 | struct thread_options_pack *top) |
| 23 | { |
| 24 | int i, j; |
| 25 | |
| 26 | string_to_cpu(&o->description, top->description); |
| 27 | string_to_cpu(&o->name, top->name); |
| 28 | string_to_cpu(&o->directory, top->directory); |
| 29 | string_to_cpu(&o->filename, top->filename); |
Jens Axboe | 22f8045 | 2013-04-09 20:29:16 +0200 | [diff] [blame] | 30 | string_to_cpu(&o->filename_format, top->filename_format); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 31 | string_to_cpu(&o->opendir, top->opendir); |
| 32 | string_to_cpu(&o->ioengine, top->ioengine); |
Jens Axboe | 83ea422 | 2012-03-28 14:01:46 +0200 | [diff] [blame] | 33 | string_to_cpu(&o->mmapfile, top->mmapfile); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 34 | string_to_cpu(&o->read_iolog_file, top->read_iolog_file); |
| 35 | string_to_cpu(&o->write_iolog_file, top->write_iolog_file); |
| 36 | string_to_cpu(&o->bw_log_file, top->bw_log_file); |
| 37 | string_to_cpu(&o->lat_log_file, top->lat_log_file); |
| 38 | string_to_cpu(&o->iops_log_file, top->iops_log_file); |
| 39 | string_to_cpu(&o->replay_redirect, top->replay_redirect); |
| 40 | string_to_cpu(&o->exec_prerun, top->exec_prerun); |
| 41 | string_to_cpu(&o->exec_postrun, top->exec_postrun); |
| 42 | string_to_cpu(&o->ioscheduler, top->ioscheduler); |
| 43 | string_to_cpu(&o->profile, top->profile); |
| 44 | string_to_cpu(&o->cgroup, top->cgroup); |
| 45 | |
| 46 | o->td_ddir = le32_to_cpu(top->td_ddir); |
| 47 | o->rw_seq = le32_to_cpu(top->rw_seq); |
| 48 | o->kb_base = le32_to_cpu(top->kb_base); |
Jens Axboe | 22f8045 | 2013-04-09 20:29:16 +0200 | [diff] [blame] | 49 | o->unit_base = le32_to_cpu(top->kb_base); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 50 | o->ddir_seq_nr = le32_to_cpu(top->ddir_seq_nr); |
| 51 | o->ddir_seq_add = le64_to_cpu(top->ddir_seq_add); |
| 52 | o->iodepth = le32_to_cpu(top->iodepth); |
| 53 | o->iodepth_low = le32_to_cpu(top->iodepth_low); |
| 54 | o->iodepth_batch = le32_to_cpu(top->iodepth_batch); |
| 55 | o->iodepth_batch_complete = le32_to_cpu(top->iodepth_batch_complete); |
| 56 | o->size = le64_to_cpu(top->size); |
| 57 | o->size_percent = le32_to_cpu(top->size_percent); |
| 58 | o->fill_device = le32_to_cpu(top->fill_device); |
| 59 | o->file_size_low = le64_to_cpu(top->file_size_low); |
| 60 | o->file_size_high = le64_to_cpu(top->file_size_high); |
| 61 | o->start_offset = le64_to_cpu(top->start_offset); |
| 62 | |
Jens Axboe | b999b3c | 2012-09-24 09:39:49 +0200 | [diff] [blame] | 63 | for (i = 0; i < DDIR_RWDIR_CNT; i++) { |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 64 | o->bs[i] = le32_to_cpu(top->bs[i]); |
| 65 | o->ba[i] = le32_to_cpu(top->ba[i]); |
| 66 | o->min_bs[i] = le32_to_cpu(top->min_bs[i]); |
| 67 | o->max_bs[i] = le32_to_cpu(top->max_bs[i]); |
| 68 | o->bssplit_nr[i] = le32_to_cpu(top->bssplit_nr[i]); |
| 69 | |
| 70 | if (o->bssplit_nr[i]) { |
| 71 | o->bssplit[i] = malloc(o->bssplit_nr[i] * sizeof(struct bssplit)); |
| 72 | for (j = 0; j < o->bssplit_nr[i]; j++) { |
| 73 | o->bssplit[i][j].bs = le32_to_cpu(top->bssplit[i][j].bs); |
| 74 | o->bssplit[i][j].perc = le32_to_cpu(top->bssplit[i][j].perc); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | o->rwmix[i] = le32_to_cpu(top->rwmix[i]); |
| 79 | o->rate[i] = le32_to_cpu(top->rate[i]); |
| 80 | o->ratemin[i] = le32_to_cpu(top->ratemin[i]); |
| 81 | o->rate_iops[i] = le32_to_cpu(top->rate_iops[i]); |
| 82 | o->rate_iops_min[i] = le32_to_cpu(top->rate_iops_min[i]); |
Jens Axboe | d947227 | 2013-07-25 10:20:45 -0600 | [diff] [blame] | 83 | |
| 84 | o->perc_rand[i] = le32_to_cpu(top->perc_rand[i]); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | o->ratecycle = le32_to_cpu(top->ratecycle); |
| 88 | o->nr_files = le32_to_cpu(top->nr_files); |
| 89 | o->open_files = le32_to_cpu(top->open_files); |
| 90 | o->file_lock_mode = le32_to_cpu(top->file_lock_mode); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 91 | o->odirect = le32_to_cpu(top->odirect); |
| 92 | o->invalidate_cache = le32_to_cpu(top->invalidate_cache); |
| 93 | o->create_serialize = le32_to_cpu(top->create_serialize); |
| 94 | o->create_fsync = le32_to_cpu(top->create_fsync); |
| 95 | o->create_on_open = le32_to_cpu(top->create_on_open); |
Jens Axboe | fb390e2 | 2012-05-07 09:54:41 +0200 | [diff] [blame] | 96 | o->create_only = le32_to_cpu(top->create_only); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 97 | o->end_fsync = le32_to_cpu(top->end_fsync); |
| 98 | o->pre_read = le32_to_cpu(top->pre_read); |
| 99 | o->sync_io = le32_to_cpu(top->sync_io); |
| 100 | o->verify = le32_to_cpu(top->verify); |
| 101 | o->do_verify = le32_to_cpu(top->do_verify); |
| 102 | o->verifysort = le32_to_cpu(top->verifysort); |
Jens Axboe | 836fcc0 | 2013-01-24 09:08:45 -0700 | [diff] [blame] | 103 | o->verifysort_nr = le32_to_cpu(top->verifysort_nr); |
| 104 | o->experimental_verify = le32_to_cpu(top->experimental_verify); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 105 | o->verify_interval = le32_to_cpu(top->verify_interval); |
| 106 | o->verify_offset = le32_to_cpu(top->verify_offset); |
| 107 | |
| 108 | memcpy(o->verify_pattern, top->verify_pattern, MAX_PATTERN_SIZE); |
| 109 | |
| 110 | o->verify_pattern_bytes = le32_to_cpu(top->verify_pattern_bytes); |
| 111 | o->verify_fatal = le32_to_cpu(top->verify_fatal); |
| 112 | o->verify_dump = le32_to_cpu(top->verify_dump); |
| 113 | o->verify_async = le32_to_cpu(top->verify_async); |
| 114 | o->verify_batch = le32_to_cpu(top->verify_batch); |
| 115 | o->use_thread = le32_to_cpu(top->use_thread); |
| 116 | o->unlink = le32_to_cpu(top->unlink); |
| 117 | o->do_disk_util = le32_to_cpu(top->do_disk_util); |
| 118 | o->override_sync = le32_to_cpu(top->override_sync); |
| 119 | o->rand_repeatable = le32_to_cpu(top->rand_repeatable); |
| 120 | o->use_os_rand = le32_to_cpu(top->use_os_rand); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 121 | o->log_avg_msec = le32_to_cpu(top->log_avg_msec); |
| 122 | o->norandommap = le32_to_cpu(top->norandommap); |
| 123 | o->softrandommap = le32_to_cpu(top->softrandommap); |
| 124 | o->bs_unaligned = le32_to_cpu(top->bs_unaligned); |
| 125 | o->fsync_on_close = le32_to_cpu(top->fsync_on_close); |
Jens Axboe | 6aca9b3 | 2013-07-25 12:45:26 -0600 | [diff] [blame] | 126 | o->bs_is_seq_rand = le32_to_cpu(top->bs_is_seq_rand); |
Jens Axboe | 1e5324e | 2012-11-14 14:25:31 -0700 | [diff] [blame] | 127 | o->random_distribution = le32_to_cpu(top->random_distribution); |
| 128 | o->zipf_theta.u.f = fio_uint64_to_double(le64_to_cpu(top->zipf_theta.u.i)); |
| 129 | o->pareto_h.u.f = fio_uint64_to_double(le64_to_cpu(top->pareto_h.u.i)); |
Jens Axboe | 49758e1 | 2012-12-03 14:37:23 +0100 | [diff] [blame] | 130 | o->random_generator = le32_to_cpu(top->random_generator); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 131 | o->hugepage_size = le32_to_cpu(top->hugepage_size); |
| 132 | o->rw_min_bs = le32_to_cpu(top->rw_min_bs); |
| 133 | o->thinktime = le32_to_cpu(top->thinktime); |
| 134 | o->thinktime_spin = le32_to_cpu(top->thinktime_spin); |
| 135 | o->thinktime_blocks = le32_to_cpu(top->thinktime_blocks); |
| 136 | o->fsync_blocks = le32_to_cpu(top->fsync_blocks); |
| 137 | o->fdatasync_blocks = le32_to_cpu(top->fdatasync_blocks); |
| 138 | o->barrier_blocks = le32_to_cpu(top->barrier_blocks); |
| 139 | |
| 140 | o->verify_backlog = le64_to_cpu(top->verify_backlog); |
| 141 | o->start_delay = le64_to_cpu(top->start_delay); |
| 142 | o->timeout = le64_to_cpu(top->timeout); |
| 143 | o->ramp_time = le64_to_cpu(top->ramp_time); |
| 144 | o->zone_range = le64_to_cpu(top->zone_range); |
| 145 | o->zone_size = le64_to_cpu(top->zone_size); |
| 146 | o->zone_skip = le64_to_cpu(top->zone_skip); |
Jens Axboe | ae278f9 | 2012-03-28 20:52:55 +0200 | [diff] [blame] | 147 | o->lockmem = le64_to_cpu(top->lockmem); |
Jens Axboe | 6a4cf74 | 2012-03-16 14:02:54 +0100 | [diff] [blame] | 148 | o->offset_increment = le64_to_cpu(top->offset_increment); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 149 | |
| 150 | o->overwrite = le32_to_cpu(top->overwrite); |
| 151 | o->bw_avg_time = le32_to_cpu(top->bw_avg_time); |
| 152 | o->iops_avg_time = le32_to_cpu(top->iops_avg_time); |
| 153 | o->loops = le32_to_cpu(top->loops); |
| 154 | o->mem_type = le32_to_cpu(top->mem_type); |
| 155 | o->mem_align = le32_to_cpu(top->mem_align); |
Jens Axboe | 1e5324e | 2012-11-14 14:25:31 -0700 | [diff] [blame] | 156 | o->max_latency = le32_to_cpu(top->max_latency); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 157 | o->stonewall = le32_to_cpu(top->stonewall); |
| 158 | o->new_group = le32_to_cpu(top->new_group); |
| 159 | o->numjobs = le32_to_cpu(top->numjobs); |
| 160 | o->cpumask_set = le32_to_cpu(top->cpumask_set); |
| 161 | o->verify_cpumask_set = le32_to_cpu(top->verify_cpumask_set); |
| 162 | o->iolog = le32_to_cpu(top->iolog); |
| 163 | o->rwmixcycle = le32_to_cpu(top->rwmixcycle); |
| 164 | o->nice = le32_to_cpu(top->nice); |
Jens Axboe | 28727df | 2012-03-29 08:33:15 +0200 | [diff] [blame] | 165 | o->ioprio = le32_to_cpu(top->ioprio); |
| 166 | o->ioprio_class = le32_to_cpu(top->ioprio_class); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 167 | o->file_service_type = le32_to_cpu(top->file_service_type); |
| 168 | o->group_reporting = le32_to_cpu(top->group_reporting); |
| 169 | o->fadvise_hint = le32_to_cpu(top->fadvise_hint); |
| 170 | o->fallocate_mode = le32_to_cpu(top->fallocate_mode); |
| 171 | o->zero_buffers = le32_to_cpu(top->zero_buffers); |
| 172 | o->refill_buffers = le32_to_cpu(top->refill_buffers); |
| 173 | o->scramble_buffers = le32_to_cpu(top->scramble_buffers); |
| 174 | o->time_based = le32_to_cpu(top->time_based); |
| 175 | o->disable_lat = le32_to_cpu(top->disable_lat); |
| 176 | o->disable_clat = le32_to_cpu(top->disable_clat); |
| 177 | o->disable_slat = le32_to_cpu(top->disable_slat); |
| 178 | o->disable_bw = le32_to_cpu(top->disable_bw); |
Jens Axboe | 95820b6 | 2013-01-31 13:23:40 +0100 | [diff] [blame] | 179 | o->unified_rw_rep = le32_to_cpu(top->unified_rw_rep); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 180 | o->gtod_reduce = le32_to_cpu(top->gtod_reduce); |
| 181 | o->gtod_cpu = le32_to_cpu(top->gtod_cpu); |
| 182 | o->gtod_offload = le32_to_cpu(top->gtod_offload); |
| 183 | o->clocksource = le32_to_cpu(top->clocksource); |
| 184 | o->no_stall = le32_to_cpu(top->no_stall); |
| 185 | o->trim_percentage = le32_to_cpu(top->trim_percentage); |
| 186 | o->trim_batch = le32_to_cpu(top->trim_batch); |
| 187 | o->trim_zero = le32_to_cpu(top->trim_zero); |
| 188 | o->clat_percentiles = le32_to_cpu(top->clat_percentiles); |
Jens Axboe | 9db01ef | 2013-02-07 15:45:39 +0100 | [diff] [blame] | 189 | o->percentile_precision = le32_to_cpu(top->percentile_precision); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 190 | o->continue_on_error = le32_to_cpu(top->continue_on_error); |
| 191 | o->cgroup_weight = le32_to_cpu(top->cgroup_weight); |
| 192 | o->cgroup_nodelete = le32_to_cpu(top->cgroup_nodelete); |
| 193 | o->uid = le32_to_cpu(top->uid); |
| 194 | o->gid = le32_to_cpu(top->gid); |
| 195 | o->flow_id = __le32_to_cpu(top->flow_id); |
| 196 | o->flow = __le32_to_cpu(top->flow); |
| 197 | o->flow_watermark = __le32_to_cpu(top->flow_watermark); |
| 198 | o->flow_sleep = le32_to_cpu(top->flow_sleep); |
| 199 | o->sync_file_range = le32_to_cpu(top->sync_file_range); |
Jens Axboe | e476994 | 2012-03-13 14:01:11 +0100 | [diff] [blame] | 200 | o->compress_percentage = le32_to_cpu(top->compress_percentage); |
| 201 | o->compress_chunk = le32_to_cpu(top->compress_chunk); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 202 | |
| 203 | o->trim_backlog = le64_to_cpu(top->trim_backlog); |
| 204 | |
| 205 | for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) |
| 206 | o->percentile_list[i].u.f = fio_uint64_to_double(le64_to_cpu(top->percentile_list[i].u.i)); |
| 207 | #if 0 |
Jens Axboe | 3c3ed07 | 2012-03-27 09:12:39 +0200 | [diff] [blame] | 208 | uint8_t cpumask[FIO_TOP_STR_MAX]; |
| 209 | uint8_t verify_cpumask[FIO_TOP_STR_MAX]; |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 210 | #endif |
| 211 | } |
| 212 | |
| 213 | void convert_thread_options_to_net(struct thread_options_pack *top, |
| 214 | struct thread_options *o) |
| 215 | { |
| 216 | int i, j; |
| 217 | |
| 218 | string_to_net(top->description, o->description); |
| 219 | string_to_net(top->name, o->name); |
| 220 | string_to_net(top->directory, o->directory); |
| 221 | string_to_net(top->filename, o->filename); |
Jens Axboe | 22f8045 | 2013-04-09 20:29:16 +0200 | [diff] [blame] | 222 | string_to_net(top->filename_format, o->filename_format); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 223 | string_to_net(top->opendir, o->opendir); |
| 224 | string_to_net(top->ioengine, o->ioengine); |
Jens Axboe | 83ea422 | 2012-03-28 14:01:46 +0200 | [diff] [blame] | 225 | string_to_net(top->mmapfile, o->mmapfile); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 226 | string_to_net(top->read_iolog_file, o->read_iolog_file); |
| 227 | string_to_net(top->write_iolog_file, o->write_iolog_file); |
| 228 | string_to_net(top->bw_log_file, o->bw_log_file); |
| 229 | string_to_net(top->lat_log_file, o->lat_log_file); |
| 230 | string_to_net(top->iops_log_file, o->iops_log_file); |
| 231 | string_to_net(top->replay_redirect, o->replay_redirect); |
| 232 | string_to_net(top->exec_prerun, o->exec_prerun); |
| 233 | string_to_net(top->exec_postrun, o->exec_postrun); |
| 234 | string_to_net(top->ioscheduler, o->ioscheduler); |
| 235 | string_to_net(top->profile, o->profile); |
| 236 | string_to_net(top->cgroup, o->cgroup); |
| 237 | |
| 238 | top->td_ddir = cpu_to_le32(o->td_ddir); |
| 239 | top->rw_seq = cpu_to_le32(o->rw_seq); |
| 240 | top->kb_base = cpu_to_le32(o->kb_base); |
Jens Axboe | 22f8045 | 2013-04-09 20:29:16 +0200 | [diff] [blame] | 241 | top->unit_base = cpu_to_le32(o->kb_base); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 242 | top->ddir_seq_nr = cpu_to_le32(o->ddir_seq_nr); |
| 243 | top->iodepth = cpu_to_le32(o->iodepth); |
| 244 | top->iodepth_low = cpu_to_le32(o->iodepth_low); |
| 245 | top->iodepth_batch = cpu_to_le32(o->iodepth_batch); |
| 246 | top->iodepth_batch_complete = cpu_to_le32(o->iodepth_batch_complete); |
| 247 | top->size_percent = cpu_to_le32(o->size_percent); |
| 248 | top->fill_device = cpu_to_le32(o->fill_device); |
| 249 | top->ratecycle = cpu_to_le32(o->ratecycle); |
| 250 | top->nr_files = cpu_to_le32(o->nr_files); |
| 251 | top->open_files = cpu_to_le32(o->open_files); |
| 252 | top->file_lock_mode = cpu_to_le32(o->file_lock_mode); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 253 | top->odirect = cpu_to_le32(o->odirect); |
| 254 | top->invalidate_cache = cpu_to_le32(o->invalidate_cache); |
| 255 | top->create_serialize = cpu_to_le32(o->create_serialize); |
| 256 | top->create_fsync = cpu_to_le32(o->create_fsync); |
| 257 | top->create_on_open = cpu_to_le32(o->create_on_open); |
Jens Axboe | fb390e2 | 2012-05-07 09:54:41 +0200 | [diff] [blame] | 258 | top->create_only = cpu_to_le32(o->create_only); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 259 | top->end_fsync = cpu_to_le32(o->end_fsync); |
| 260 | top->pre_read = cpu_to_le32(o->pre_read); |
| 261 | top->sync_io = cpu_to_le32(o->sync_io); |
| 262 | top->verify = cpu_to_le32(o->verify); |
| 263 | top->do_verify = cpu_to_le32(o->do_verify); |
| 264 | top->verifysort = cpu_to_le32(o->verifysort); |
Jens Axboe | 836fcc0 | 2013-01-24 09:08:45 -0700 | [diff] [blame] | 265 | top->verifysort_nr = cpu_to_le32(o->verifysort_nr); |
| 266 | top->experimental_verify = cpu_to_le32(o->experimental_verify); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 267 | top->verify_interval = cpu_to_le32(o->verify_interval); |
| 268 | top->verify_offset = cpu_to_le32(o->verify_offset); |
| 269 | top->verify_pattern_bytes = cpu_to_le32(o->verify_pattern_bytes); |
| 270 | top->verify_fatal = cpu_to_le32(o->verify_fatal); |
| 271 | top->verify_dump = cpu_to_le32(o->verify_dump); |
| 272 | top->verify_async = cpu_to_le32(o->verify_async); |
| 273 | top->verify_batch = cpu_to_le32(o->verify_batch); |
| 274 | top->use_thread = cpu_to_le32(o->use_thread); |
| 275 | top->unlink = cpu_to_le32(o->unlink); |
| 276 | top->do_disk_util = cpu_to_le32(o->do_disk_util); |
| 277 | top->override_sync = cpu_to_le32(o->override_sync); |
| 278 | top->rand_repeatable = cpu_to_le32(o->rand_repeatable); |
| 279 | top->use_os_rand = cpu_to_le32(o->use_os_rand); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 280 | top->log_avg_msec = cpu_to_le32(o->log_avg_msec); |
| 281 | top->norandommap = cpu_to_le32(o->norandommap); |
| 282 | top->softrandommap = cpu_to_le32(o->softrandommap); |
| 283 | top->bs_unaligned = cpu_to_le32(o->bs_unaligned); |
| 284 | top->fsync_on_close = cpu_to_le32(o->fsync_on_close); |
Jens Axboe | 6aca9b3 | 2013-07-25 12:45:26 -0600 | [diff] [blame] | 285 | top->bs_is_seq_rand = cpu_to_le32(o->bs_is_seq_rand); |
Jens Axboe | 1e5324e | 2012-11-14 14:25:31 -0700 | [diff] [blame] | 286 | top->random_distribution = cpu_to_le32(o->random_distribution); |
| 287 | top->zipf_theta.u.i = __cpu_to_le64(fio_double_to_uint64(o->zipf_theta.u.f)); |
| 288 | top->pareto_h.u.i = __cpu_to_le64(fio_double_to_uint64(o->pareto_h.u.f)); |
Jens Axboe | 49758e1 | 2012-12-03 14:37:23 +0100 | [diff] [blame] | 289 | top->random_generator = cpu_to_le32(o->random_generator); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 290 | top->hugepage_size = cpu_to_le32(o->hugepage_size); |
| 291 | top->rw_min_bs = cpu_to_le32(o->rw_min_bs); |
| 292 | top->thinktime = cpu_to_le32(o->thinktime); |
| 293 | top->thinktime_spin = cpu_to_le32(o->thinktime_spin); |
| 294 | top->thinktime_blocks = cpu_to_le32(o->thinktime_blocks); |
| 295 | top->fsync_blocks = cpu_to_le32(o->fsync_blocks); |
| 296 | top->fdatasync_blocks = cpu_to_le32(o->fdatasync_blocks); |
| 297 | top->barrier_blocks = cpu_to_le32(o->barrier_blocks); |
| 298 | top->overwrite = cpu_to_le32(o->overwrite); |
| 299 | top->bw_avg_time = cpu_to_le32(o->bw_avg_time); |
| 300 | top->iops_avg_time = cpu_to_le32(o->iops_avg_time); |
| 301 | top->loops = cpu_to_le32(o->loops); |
| 302 | top->mem_type = cpu_to_le32(o->mem_type); |
| 303 | top->mem_align = cpu_to_le32(o->mem_align); |
Jens Axboe | 1e5324e | 2012-11-14 14:25:31 -0700 | [diff] [blame] | 304 | top->max_latency = cpu_to_le32(o->max_latency); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 305 | top->stonewall = cpu_to_le32(o->stonewall); |
| 306 | top->new_group = cpu_to_le32(o->new_group); |
| 307 | top->numjobs = cpu_to_le32(o->numjobs); |
| 308 | top->cpumask_set = cpu_to_le32(o->cpumask_set); |
| 309 | top->verify_cpumask_set = cpu_to_le32(o->verify_cpumask_set); |
| 310 | top->iolog = cpu_to_le32(o->iolog); |
| 311 | top->rwmixcycle = cpu_to_le32(o->rwmixcycle); |
| 312 | top->nice = cpu_to_le32(o->nice); |
Jens Axboe | 28727df | 2012-03-29 08:33:15 +0200 | [diff] [blame] | 313 | top->ioprio = cpu_to_le32(o->ioprio); |
| 314 | top->ioprio_class = cpu_to_le32(o->ioprio_class); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 315 | top->file_service_type = cpu_to_le32(o->file_service_type); |
| 316 | top->group_reporting = cpu_to_le32(o->group_reporting); |
| 317 | top->fadvise_hint = cpu_to_le32(o->fadvise_hint); |
| 318 | top->fallocate_mode = cpu_to_le32(o->fallocate_mode); |
| 319 | top->zero_buffers = cpu_to_le32(o->zero_buffers); |
| 320 | top->refill_buffers = cpu_to_le32(o->refill_buffers); |
| 321 | top->scramble_buffers = cpu_to_le32(o->scramble_buffers); |
| 322 | top->time_based = cpu_to_le32(o->time_based); |
| 323 | top->disable_lat = cpu_to_le32(o->disable_lat); |
| 324 | top->disable_clat = cpu_to_le32(o->disable_clat); |
| 325 | top->disable_slat = cpu_to_le32(o->disable_slat); |
| 326 | top->disable_bw = cpu_to_le32(o->disable_bw); |
Jens Axboe | 95820b6 | 2013-01-31 13:23:40 +0100 | [diff] [blame] | 327 | top->unified_rw_rep = cpu_to_le32(o->unified_rw_rep); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 328 | top->gtod_reduce = cpu_to_le32(o->gtod_reduce); |
| 329 | top->gtod_cpu = cpu_to_le32(o->gtod_cpu); |
| 330 | top->gtod_offload = cpu_to_le32(o->gtod_offload); |
| 331 | top->clocksource = cpu_to_le32(o->clocksource); |
| 332 | top->no_stall = cpu_to_le32(o->no_stall); |
| 333 | top->trim_percentage = cpu_to_le32(o->trim_percentage); |
| 334 | top->trim_batch = cpu_to_le32(o->trim_batch); |
| 335 | top->trim_zero = cpu_to_le32(o->trim_zero); |
| 336 | top->clat_percentiles = cpu_to_le32(o->clat_percentiles); |
Jens Axboe | 9db01ef | 2013-02-07 15:45:39 +0100 | [diff] [blame] | 337 | top->percentile_precision = cpu_to_le32(o->percentile_precision); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 338 | top->continue_on_error = cpu_to_le32(o->continue_on_error); |
| 339 | top->cgroup_weight = cpu_to_le32(o->cgroup_weight); |
| 340 | top->cgroup_nodelete = cpu_to_le32(o->cgroup_nodelete); |
| 341 | top->uid = cpu_to_le32(o->uid); |
| 342 | top->gid = cpu_to_le32(o->gid); |
| 343 | top->flow_id = __cpu_to_le32(o->flow_id); |
| 344 | top->flow = __cpu_to_le32(o->flow); |
| 345 | top->flow_watermark = __cpu_to_le32(o->flow_watermark); |
| 346 | top->flow_sleep = cpu_to_le32(o->flow_sleep); |
| 347 | top->sync_file_range = cpu_to_le32(o->sync_file_range); |
Jens Axboe | e476994 | 2012-03-13 14:01:11 +0100 | [diff] [blame] | 348 | top->compress_percentage = cpu_to_le32(o->compress_percentage); |
| 349 | top->compress_chunk = cpu_to_le32(o->compress_chunk); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 350 | |
Jens Axboe | b999b3c | 2012-09-24 09:39:49 +0200 | [diff] [blame] | 351 | for (i = 0; i < DDIR_RWDIR_CNT; i++) { |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 352 | top->bs[i] = cpu_to_le32(o->bs[i]); |
| 353 | top->ba[i] = cpu_to_le32(o->ba[i]); |
| 354 | top->min_bs[i] = cpu_to_le32(o->min_bs[i]); |
| 355 | top->max_bs[i] = cpu_to_le32(o->max_bs[i]); |
| 356 | top->bssplit_nr[i] = cpu_to_le32(o->bssplit_nr[i]); |
| 357 | |
| 358 | if (o->bssplit_nr[i]) { |
| 359 | unsigned int bssplit_nr = o->bssplit_nr[i]; |
| 360 | |
| 361 | if (bssplit_nr > BSSPLIT_MAX) { |
| 362 | log_err("fio: BSSPLIT_MAX is too small\n"); |
| 363 | bssplit_nr = BSSPLIT_MAX; |
| 364 | } |
| 365 | for (j = 0; j < bssplit_nr; j++) { |
| 366 | top->bssplit[i][j].bs = cpu_to_le32(o->bssplit[i][j].bs); |
| 367 | top->bssplit[i][j].perc = cpu_to_le32(o->bssplit[i][j].perc); |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | top->rwmix[i] = cpu_to_le32(o->rwmix[i]); |
| 372 | top->rate[i] = cpu_to_le32(o->rate[i]); |
| 373 | top->ratemin[i] = cpu_to_le32(o->ratemin[i]); |
| 374 | top->rate_iops[i] = cpu_to_le32(o->rate_iops[i]); |
| 375 | top->rate_iops_min[i] = cpu_to_le32(o->rate_iops_min[i]); |
Jens Axboe | d947227 | 2013-07-25 10:20:45 -0600 | [diff] [blame] | 376 | |
| 377 | top->perc_rand[i] = cpu_to_le32(o->perc_rand[i]); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | memcpy(top->verify_pattern, o->verify_pattern, MAX_PATTERN_SIZE); |
| 381 | |
| 382 | top->size = __cpu_to_le64(o->size); |
| 383 | top->verify_backlog = __cpu_to_le64(o->verify_backlog); |
| 384 | top->start_delay = __cpu_to_le64(o->start_delay); |
| 385 | top->timeout = __cpu_to_le64(o->timeout); |
| 386 | top->ramp_time = __cpu_to_le64(o->ramp_time); |
| 387 | top->zone_range = __cpu_to_le64(o->zone_range); |
| 388 | top->zone_size = __cpu_to_le64(o->zone_size); |
| 389 | top->zone_skip = __cpu_to_le64(o->zone_skip); |
Jens Axboe | ae278f9 | 2012-03-28 20:52:55 +0200 | [diff] [blame] | 390 | top->lockmem = __cpu_to_le64(o->lockmem); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 391 | top->ddir_seq_add = __cpu_to_le64(o->ddir_seq_add); |
| 392 | top->file_size_low = __cpu_to_le64(o->file_size_low); |
| 393 | top->file_size_high = __cpu_to_le64(o->file_size_high); |
| 394 | top->start_offset = __cpu_to_le64(o->start_offset); |
| 395 | top->trim_backlog = __cpu_to_le64(o->trim_backlog); |
Jens Axboe | 6a4cf74 | 2012-03-16 14:02:54 +0100 | [diff] [blame] | 396 | top->offset_increment = __cpu_to_le64(o->offset_increment); |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 397 | |
| 398 | for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) |
| 399 | top->percentile_list[i].u.i = __cpu_to_le64(fio_double_to_uint64(o->percentile_list[i].u.f)); |
| 400 | #if 0 |
Jens Axboe | 3c3ed07 | 2012-03-27 09:12:39 +0200 | [diff] [blame] | 401 | uint8_t cpumask[FIO_TOP_STR_MAX]; |
| 402 | uint8_t verify_cpumask[FIO_TOP_STR_MAX]; |
Jens Axboe | 2dc1cbb | 2012-03-08 14:52:25 +0100 | [diff] [blame] | 403 | #endif |
| 404 | |
| 405 | } |
| 406 | |
Jens Axboe | 5116779 | 2012-03-08 21:34:18 +0100 | [diff] [blame] | 407 | /* |
| 408 | * Basic conversion test. We'd really need to fill in more of the options |
| 409 | * to have a thorough test. Even better, we should auto-generate the |
| 410 | * converter functions... |
| 411 | */ |
| 412 | int fio_test_cconv(struct thread_options *__o) |
| 413 | { |
| 414 | struct thread_options o; |
| 415 | struct thread_options_pack top1, top2; |
| 416 | |
| 417 | memset(&top1, 0, sizeof(top1)); |
| 418 | memset(&top2, 0, sizeof(top2)); |
| 419 | |
| 420 | convert_thread_options_to_net(&top1, __o); |
| 421 | memset(&o, 0, sizeof(o)); |
| 422 | convert_thread_options_to_cpu(&o, &top1); |
| 423 | convert_thread_options_to_net(&top2, &o); |
| 424 | |
| 425 | return memcmp(&top1, &top2, sizeof(top1)); |
| 426 | } |