X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=filesetup.c;h=f3d38290179e80d9eacefb5f2a97ef4abd479720;hp=8f515923bcf9b25c725c9d9a3e94ed2ecb1711a3;hb=057754389863aa18cbf36b1f2a556a422ea2f4b5;hpb=7bb591020669b7266c57108f2a68b48a03ae72ee diff --git a/filesetup.c b/filesetup.c index 8f515923..f3d38290 100644 --- a/filesetup.c +++ b/filesetup.c @@ -713,7 +713,8 @@ int setup_files(struct thread_data *td) extend_size = total_size = 0; need_extend = 0; for_each_file(td, f, i) { - f->file_offset = td->o.start_offset; + f->file_offset = td->o.start_offset + + (td->thread_number - 1) * td->o.offset_increment; if (!td->o.file_size_low) { /* @@ -849,11 +850,15 @@ int init_random_map(struct thread_data *td) (unsigned long long) td->o.rw_min_bs; num_maps = (blocks + BLOCKS_PER_MAP - 1) / (unsigned long long) BLOCKS_PER_MAP; - f->file_map = smalloc(num_maps * sizeof(unsigned long)); - if (f->file_map) { - f->num_maps = num_maps; - continue; - } + if (num_maps == (unsigned long) num_maps) { + f->file_map = smalloc(num_maps * sizeof(unsigned long)); + if (f->file_map) { + f->num_maps = num_maps; + continue; + } + } else + f->file_map = NULL; + if (!td->o.softrandommap) { log_err("fio: failed allocating random map. If running" " a large number of jobs, try the 'norandommap'" @@ -922,10 +927,13 @@ static void get_file_type(struct fio_file *f) else f->filetype = FIO_TYPE_FILE; + /* \\.\ is the device namespace in Windows, where every file is + * a block device */ + if (strncmp(f->file_name, "\\\\.\\", 4) == 0) + f->filetype = FIO_TYPE_BD; + if (!stat(f->file_name, &sb)) { - /* \\.\ is the device namespace in Windows, where every file is - * a block device */ - if (S_ISBLK(sb.st_mode) || strncmp(f->file_name, "\\\\.\\", 4) == 0) + if (S_ISBLK(sb.st_mode)) f->filetype = FIO_TYPE_BD; else if (S_ISCHR(sb.st_mode)) f->filetype = FIO_TYPE_CHAR; @@ -1134,7 +1142,7 @@ static int recurse_dir(struct thread_data *td, const char *dirname) if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) continue; - sprintf(full_path, "%s/%s", dirname, dir->d_name); + sprintf(full_path, "%s%s%s", dirname, FIO_OS_PATH_SEPARATOR, dir->d_name); if (lstat(full_path, &sb) == -1) { if (errno != ENOENT) {