Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
#include <sys/types.h>
#include "fio.h"
#include <sys/types.h>
#include "fio.h"
for_each_file(td, f, i) {
blocks = (f->real_file_size + td->o.rw_min_bs - 1) / (unsigned long long) td->o.rw_min_bs;
num_maps = (blocks + BLOCKS_PER_MAP-1)/ (unsigned long long) BLOCKS_PER_MAP;
for_each_file(td, f, i) {
blocks = (f->real_file_size + td->o.rw_min_bs - 1) / (unsigned long long) td->o.rw_min_bs;
num_maps = (blocks + BLOCKS_PER_MAP-1)/ (unsigned long long) BLOCKS_PER_MAP;
- f->file_map = malloc(num_maps * sizeof(long));
+ f->file_map = smalloc(num_maps * sizeof(long));
if (!f->file_map) {
log_err("fio: failed allocating random map. If running a large number of jobs, try the 'norandommap' option\n");
return 1;
}
f->num_maps = num_maps;
if (!f->file_map) {
log_err("fio: failed allocating random map. If running a large number of jobs, try the 'norandommap' option\n");
return 1;
}
f->num_maps = num_maps;
- memset(f->file_map, 0, num_maps * sizeof(long));
f->file_name = NULL;
if (f->file_map) {
f->file_name = NULL;
if (f->file_map) {
dprint(FD_FILE, "add file %s\n", fname);
dprint(FD_FILE, "add file %s\n", fname);
- f = malloc(sizeof(*f));
- memset(f, 0, sizeof(*f));
+ f = smalloc(sizeof(*f));
f->fd = -1;
td->files = realloc(td->files, (cur_files + 1) * sizeof(f));
f->fd = -1;
td->files = realloc(td->files, (cur_files + 1) * sizeof(f));
len = sprintf(file_name, "%s/", td->o.directory);
sprintf(file_name + len, "%s", fname);
len = sprintf(file_name, "%s/", td->o.directory);
sprintf(file_name + len, "%s", fname);
- f->file_name = strdup(file_name);
+ f->file_name = smalloc_strdup(file_name);
for_each_file(td, f, i) {
struct fio_file *__f;
for_each_file(td, f, i) {
struct fio_file *__f;
- __f = malloc(sizeof(*__f));
- memset(f, 0, sizeof(*__f));
+ __f = smalloc(sizeof(*__f));
- __f->file_name = strdup(f->file_name);
+ __f->file_name = smalloc_strdup(f->file_name);