summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
af52b34)
We'll need more flags in the next commits, so do this as a
preparatory patch.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
/*
* Only unlink files that we created.
*/
/*
* Only unlink files that we created.
*/
+ f->flags &= ~FIO_FILE_UNLINK;
- f->unlink = td->unlink;
+ if (td->unlink)
+ f->flags |= FIO_FILE_UNLINK;
+
err = create_file(td, f);
if (err)
break;
err = create_file(td, f);
if (err)
break;
unsigned int i;
for_each_file(td, f, i) {
unsigned int i;
for_each_file(td, f, i) {
- if (!td->filename && f->unlink &&
+ if (!td->filename && (f->flags & FIO_FILE_UNLINK) &&
f->filetype == FIO_TYPE_FILE) {
unlink(f->file_name);
f->file_name = NULL;
f->filetype == FIO_TYPE_FILE) {
unlink(f->file_name);
f->file_name = NULL;
FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
};
FIO_NODISKUTIL = 1 << 4, /* diskutil can't handle filename */
};
+enum fio_file_flags {
+ FIO_FILE_OPEN = 1 << 0,
+ FIO_FILE_UNLINK = 1 << 1,
+};
+
/*
* Each thread_data structure has a number of files associated with it,
* this structure holds state information for a single file.
/*
* Each thread_data structure has a number of files associated with it,
* this structure holds state information for a single file.
unsigned int num_maps;
unsigned int last_free_lookup;
unsigned int num_maps;
unsigned int last_free_lookup;
- unsigned int unlink;
- unsigned int open;
+ enum fio_file_flags flags;
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 (f->flags & FIO_FILE_OPEN)
if (td->next_file >= td->open_files)
td->next_file = 0;
if (td->next_file >= td->open_files)
td->next_file = 0;
+ if (f->flags & FIO_FILE_OPEN)
return NULL;
f = td->file_service_file;
return NULL;
f = td->file_service_file;
- if (f && f->open && td->file_service_left--)
+ if (f && (f->flags & FIO_FILE_OPEN) && td->file_service_left--)
return f;
if (td->file_service_type == FIO_FSERVICE_RR)
return f;
if (td->file_service_type == FIO_FSERVICE_RR)
f->last_free_lookup = 0;
f->last_completed_pos = 0;
f->last_pos = 0;
f->last_free_lookup = 0;
f->last_completed_pos = 0;
f->last_pos = 0;
+ f->flags |= FIO_FILE_OPEN;
if (f->file_map)
memset(f->file_map, 0, f->num_maps * sizeof(long));
if (f->file_map)
memset(f->file_map, 0, f->num_maps * sizeof(long));
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 (f->flags & FIO_FILE_OPEN) {
if (td->io_ops->close_file)
td->io_ops->close_file(td, f);
td->nr_open_files--;
if (td->io_ops->close_file)
td->io_ops->close_file(td, f);
td->nr_open_files--;
+ f->flags &= ~FIO_FILE_OPEN;