We can't always rely on the engine options for the file, as files
can come from various places. So mark the file as having come from
smalloc/calloc and use that when freeing it.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
FIO_FILE_partial_mmap = 1 << 6, /* can't do full mmap */
FIO_FILE_axmap = 1 << 7, /* uses axmap */
FIO_FILE_lfsr = 1 << 8, /* lfsr is used */
+ FIO_FILE_smalloc = 1 << 9, /* smalloc file/file_name */
};
enum file_lock_mode {
FILE_FLAG_FNS(partial_mmap);
FILE_FLAG_FNS(axmap);
FILE_FLAG_FNS(lfsr);
+FILE_FLAG_FNS(smalloc);
#undef FILE_FLAG_FNS
/*
{
struct fio_file *f;
unsigned int i;
- bool use_free = td_ioengine_flagged(td, FIO_NOFILEHASH);
dprint(FD_FILE, "close files\n");
zbd_close_file(f);
- if (use_free)
+ if (!fio_file_smalloc(f))
free(f->file_name);
else
sfree(f->file_name);
axmap_free(f->io_axmap);
f->io_axmap = NULL;
}
- if (use_free)
+ if (!fio_file_smalloc(f))
free(f);
else
sfree(f);
f->fd = -1;
f->shadow_fd = -1;
fio_file_reset(td, f);
+ if (!td_ioengine_flagged(td, FIO_NOFILEHASH))
+ fio_file_set_smalloc(f);
return f;
}