}
}
+ 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;
(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) {