r = blockdev_size(f, &bytes);
if (r) {
td_verror(td, r, "blockdev_size");
- printf("fd is %d\n", f->fd);
goto err;
}
dprint(FD_FILE, "setup files\n");
if (td->o.read_iolog_file)
- return 0;
+ goto done;
/*
* if ioengine defines a setup() method, it's responsible for
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) {
/*
}
}
+ if (td->o.size_percent)
+ total_size = (total_size * td->o.size_percent) / 100;
+
if (!td->o.size || td->o.size > total_size)
td->o.size = total_size;
*/
if (!td->o.read_iolog_file)
td->total_io_size = td->o.size * td->o.loops;
+
+done:
+ if (td->o.create_only)
+ td->done = 1;
+
return 0;
err_offset:
log_err("%s: you need to specify valid offset=\n", td->o.name);
(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'"
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;
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) {