summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e643357)
Don't use ->fd == -1 to check for the file being open or not,
an io engine could be non-fd based.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
unsigned int last_free_lookup;
unsigned int unlink;
unsigned int last_free_lookup;
unsigned int unlink;
fileno = (unsigned int) ((double) (td->open_files * r) / (RAND_MAX + 1.0));
f = &td->files[fileno];
fileno = (unsigned int) ((double) (td->open_files * r) / (RAND_MAX + 1.0));
f = &td->files[fileno];
if (td->next_file >= td->open_files)
td->next_file = 0;
if (td->next_file >= td->open_files)
td->next_file = 0;
int td_io_open_file(struct thread_data *td, struct fio_file *f)
{
if (!td->io_ops->open_file(td, f)) {
int td_io_open_file(struct thread_data *td, struct fio_file *f)
{
if (!td->io_ops->open_file(td, f)) {
td->nr_open_files++;
return 0;
}
td->nr_open_files++;
return 0;
}
void td_io_close_file(struct thread_data *td, struct fio_file *f)
{
void td_io_close_file(struct thread_data *td, struct fio_file *f)
{
- if (td->io_ops->close_file)
- td->io_ops->close_file(td, f);
- td->nr_open_files--;
+ if (f->open) {
+ if (td->io_ops->close_file)
+ td->io_ops->close_file(td, f);
+ td->nr_open_files--;
+ f->open = 0;
+ }