X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=cconv.c;h=502cf82eaa5fc213b83f2189090c2d878ed0f6d1;hb=40c605169e60d32fc321a2f9f465e76cba745489;hp=f16e0d6a90b80dc7c5cabde2f1baeab03fee68e4;hpb=2dc1cbb52f73303d479a72e99930a2838c4b0fa4;p=fio.git diff --git a/cconv.c b/cconv.c index f16e0d6a..502cf82e 100644 --- a/cconv.c +++ b/cconv.c @@ -1,3 +1,5 @@ +#include + #include "thread_options.h" static void string_to_cpu(char **dst, const uint8_t *src) @@ -133,6 +135,7 @@ void convert_thread_options_to_cpu(struct thread_options *o, o->zone_range = le64_to_cpu(top->zone_range); o->zone_size = le64_to_cpu(top->zone_size); o->zone_skip = le64_to_cpu(top->zone_skip); + o->offset_increment = le64_to_cpu(top->offset_increment); o->overwrite = le32_to_cpu(top->overwrite); o->bw_avg_time = le32_to_cpu(top->bw_avg_time); @@ -170,8 +173,6 @@ void convert_thread_options_to_cpu(struct thread_options *o, o->trim_zero = le32_to_cpu(top->trim_zero); o->clat_percentiles = le32_to_cpu(top->clat_percentiles); o->overwrite_plist = le32_to_cpu(top->overwrite_plist); - o->cpuload = le32_to_cpu(top->cpuload); - o->cpucycle = le32_to_cpu(top->cpucycle); o->continue_on_error = le32_to_cpu(top->continue_on_error); o->cgroup_weight = le32_to_cpu(top->cgroup_weight); o->cgroup_nodelete = le32_to_cpu(top->cgroup_nodelete); @@ -182,14 +183,16 @@ void convert_thread_options_to_cpu(struct thread_options *o, o->flow_watermark = __le32_to_cpu(top->flow_watermark); o->flow_sleep = le32_to_cpu(top->flow_sleep); o->sync_file_range = le32_to_cpu(top->sync_file_range); + o->compress_percentage = le32_to_cpu(top->compress_percentage); + o->compress_chunk = le32_to_cpu(top->compress_chunk); o->trim_backlog = le64_to_cpu(top->trim_backlog); for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) o->percentile_list[i].u.f = fio_uint64_to_double(le64_to_cpu(top->percentile_list[i].u.i)); #if 0 - uint8_t cpumask[FIO_TOP_STR_MAX]; - uint8_t verify_cpumask[FIO_TOP_STR_MAX]; + uint8_t cpumask[FIO_TOP_STR_MAX]; + uint8_t verify_cpumask[FIO_TOP_STR_MAX]; #endif } @@ -307,8 +310,6 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->trim_zero = cpu_to_le32(o->trim_zero); top->clat_percentiles = cpu_to_le32(o->clat_percentiles); top->overwrite_plist = cpu_to_le32(o->overwrite_plist); - top->cpuload = cpu_to_le32(o->cpuload); - top->cpucycle = cpu_to_le32(o->cpucycle); top->continue_on_error = cpu_to_le32(o->continue_on_error); top->cgroup_weight = cpu_to_le32(o->cgroup_weight); top->cgroup_nodelete = cpu_to_le32(o->cgroup_nodelete); @@ -319,6 +320,8 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->flow_watermark = __cpu_to_le32(o->flow_watermark); top->flow_sleep = cpu_to_le32(o->flow_sleep); top->sync_file_range = cpu_to_le32(o->sync_file_range); + top->compress_percentage = cpu_to_le32(o->compress_percentage); + top->compress_chunk = cpu_to_le32(o->compress_chunk); for (i = 0; i < 2; i++) { top->bs[i] = cpu_to_le32(o->bs[i]); @@ -362,13 +365,34 @@ void convert_thread_options_to_net(struct thread_options_pack *top, top->file_size_high = __cpu_to_le64(o->file_size_high); top->start_offset = __cpu_to_le64(o->start_offset); top->trim_backlog = __cpu_to_le64(o->trim_backlog); + top->offset_increment = __cpu_to_le64(o->offset_increment); for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) top->percentile_list[i].u.i = __cpu_to_le64(fio_double_to_uint64(o->percentile_list[i].u.f)); #if 0 - uint8_t cpumask[FIO_TOP_STR_MAX]; - uint8_t verify_cpumask[FIO_TOP_STR_MAX]; + uint8_t cpumask[FIO_TOP_STR_MAX]; + uint8_t verify_cpumask[FIO_TOP_STR_MAX]; #endif } +/* + * Basic conversion test. We'd really need to fill in more of the options + * to have a thorough test. Even better, we should auto-generate the + * converter functions... + */ +int fio_test_cconv(struct thread_options *__o) +{ + struct thread_options o; + struct thread_options_pack top1, top2; + + memset(&top1, 0, sizeof(top1)); + memset(&top2, 0, sizeof(top2)); + + convert_thread_options_to_net(&top1, __o); + memset(&o, 0, sizeof(o)); + convert_thread_options_to_cpu(&o, &top1); + convert_thread_options_to_net(&top2, &o); + + return memcmp(&top1, &top2, sizeof(top1)); +}