X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=init.c;h=6ad3c64c4221124d779ae982ac3b96ee12ced5bc;hp=732cceb993755a7ac2c5b6f3672c13c5950664b8;hb=7c7118c7ade7b63d9107ecd5c7168391ce4aaf1a;hpb=fee3bb48f748afe5cf10f8505e1efd36b87c627e diff --git a/init.c b/init.c index 732cceb9..6ad3c64c 100644 --- a/init.c +++ b/init.c @@ -51,6 +51,7 @@ #define DEF_UNLINK (0) #define DEF_WRITE_BW_LOG (0) #define DEF_WRITE_LAT_LOG (0) +#define DEF_NO_RAND_MAP (0) #define td_var_offset(var) ((size_t) &((struct thread_data *)0)->var) @@ -342,6 +343,16 @@ static struct fio_option options[] = { .type = FIO_OPT_STR_SET, .off1 = td_var_offset(write_lat_log), }, + { + .name = "norandommap", + .type = FIO_OPT_STR_SET, + .off1 = td_var_offset(norandommap), + }, + { + .name = "bs_unaligned", + .type = FIO_OPT_STR_SET, + .off1 = td_var_offset(bs_unaligned), + }, { .name = NULL, }, @@ -479,6 +490,13 @@ static void fixup_options(struct thread_data *td) td->max_bs = td->bs; if (td_read(td) && !td_rw(td)) td->verify = 0; + + if (td->norandommap && td->verify != VERIFY_NONE) { + log_err("fio: norandommap given, verify disabled\n"); + td->verify = VERIFY_NONE; + } + if (td->bs_unaligned && (td->odirect || td->io_ops->flags & FIO_RAWIO)) + log_err("fio: bs_unaligned may not work with raw io\n"); } /* @@ -524,6 +542,9 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num) } } + if (td->odirect) + td->io_ops->flags |= FIO_RAWIO; + fixup_options(td); td->filetype = FIO_TYPE_FILE; @@ -534,9 +555,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num) td->filetype = FIO_TYPE_CHAR; } - if (td->odirect) - td->io_ops->flags |= FIO_RAWIO; - if (td->filename) td->nr_uniq_files = 1; else @@ -674,12 +692,14 @@ int init_random_state(struct thread_data *td) if (td->rand_repeatable) seeds[3] = DEF_RANDSEED; - for_each_file(td, f, i) { - blocks = (f->file_size + td->min_bs - 1) / td->min_bs; - num_maps = blocks / BLOCKS_PER_MAP; - f->file_map = malloc(num_maps * sizeof(long)); - f->num_maps = num_maps; - memset(f->file_map, 0, num_maps * sizeof(long)); + if (!td->norandommap) { + for_each_file(td, f, i) { + blocks = (f->file_size + td->min_bs - 1) / td->min_bs; + num_maps = blocks / BLOCKS_PER_MAP; + f->file_map = malloc(num_maps * sizeof(long)); + f->num_maps = num_maps; + memset(f->file_map, 0, num_maps * sizeof(long)); + } } os_random_seed(seeds[3], &td->random_state); @@ -860,8 +880,9 @@ int parse_jobs_ini(char *file, int stonewall_flag) memset(name, 0, 256); stonewall = stonewall_flag; - while ((p = fgets(string, 4096, f)) != NULL) { - if (ret) + do { + p = fgets(string, 4095, f); + if (!p) break; if (is_empty_or_comment(p)) continue; @@ -890,10 +911,12 @@ int parse_jobs_ini(char *file, int stonewall_flag) while ((p = fgets(string, 4096, f)) != NULL) { if (is_empty_or_comment(p)) continue; - if (strstr(p, "[")) - break; strip_blank_front(&p); + + if (p[0] == '[') + break; + strip_blank_end(p); fgetpos(f, &off); @@ -903,16 +926,14 @@ int parse_jobs_ini(char *file, int stonewall_flag) * dump all the bad ones. Makes trial/error fixups * easier on the user. */ - ret = parse_option(p, options, td); + ret |= parse_option(p, options, td); } if (!ret) { fsetpos(f, &off); ret = add_job(td, name, 0); } - if (ret) - break; - } + } while (!ret); free(string); free(name); @@ -961,6 +982,7 @@ static int fill_def_thread(void) def_thread.unlink = DEF_UNLINK; def_thread.write_bw_log = write_bw_log; def_thread.write_lat_log = write_lat_log; + def_thread.norandommap = DEF_NO_RAND_MAP; #ifdef FIO_HAVE_DISK_UTIL def_thread.do_disk_util = 1; #endif