projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sg engine: IO should be done sync of O_SYNC and O_DIRECT
[fio.git]
/
filesetup.c
diff --git
a/filesetup.c
b/filesetup.c
index 57928133369cdd520a1b89052cbc9362b773ca78..a0a4b80d33483d70c00db8fe56882ce073136286 100644
(file)
--- a/
filesetup.c
+++ b/
filesetup.c
@@
-246,6
+246,7
@@
static int bdev_size(struct thread_data *td, struct fio_file *f)
}
f->real_file_size = bytes;
}
f->real_file_size = bytes;
+ td->io_ops->close_file(td, f);
return 0;
err:
td->io_ops->close_file(td, f);
return 0;
err:
td->io_ops->close_file(td, f);
@@
-435,7
+436,7
@@
open_again:
char buf[FIO_VERROR_SIZE];
int __e = errno;
char buf[FIO_VERROR_SIZE];
int __e = errno;
- if (
errno
== EPERM && (flags & FIO_O_NOATIME)) {
+ if (
__e
== EPERM && (flags & FIO_O_NOATIME)) {
flags &= ~FIO_O_NOATIME;
goto open_again;
}
flags &= ~FIO_O_NOATIME;
goto open_again;
}
@@
-709,8
+710,10
@@
void close_files(struct thread_data *td)
struct fio_file *f;
unsigned int i;
struct fio_file *f;
unsigned int i;
- for_each_file(td, f, i)
- td_io_close_file(td, f);
+ for_each_file(td, f, i) {
+ if (fio_file_open(f))
+ td_io_close_file(td, f);
+ }
}
void close_and_free_files(struct thread_data *td)
}
void close_and_free_files(struct thread_data *td)
@@
-726,7
+729,9
@@
void close_and_free_files(struct thread_data *td)
unlink(f->file_name);
}
unlink(f->file_name);
}
- td_io_close_file(td, f);
+ if (fio_file_open(f))
+ td_io_close_file(td, f);
+
remove_file_hash(f);
sfree(f->file_name);
remove_file_hash(f);
sfree(f->file_name);
@@
-847,8
+852,10
@@
int put_file(struct thread_data *td, struct fio_file *f)
dprint(FD_FILE, "put file %s, ref=%d\n", f->file_name, f->references);
dprint(FD_FILE, "put file %s, ref=%d\n", f->file_name, f->references);
- if (!fio_file_open(f))
+ if (!fio_file_open(f)) {
+ assert(f->fd == -1);
return 0;
return 0;
+ }
assert(f->references);
if (--f->references)
assert(f->references);
if (--f->references)
@@
-865,6
+872,7
@@
int put_file(struct thread_data *td, struct fio_file *f)
td->nr_open_files--;
fio_file_clear_open(f);
td->nr_open_files--;
fio_file_clear_open(f);
+ assert(f->fd == -1);
return ret;
}
return ret;
}
@@
-1004,6
+1012,7
@@
void dup_files(struct thread_data *td, struct thread_data *org)
log_err("fio: smalloc OOM\n");
assert(0);
}
log_err("fio: smalloc OOM\n");
assert(0);
}
+ __f->fd = -1;
if (f->file_name) {
__f->file_name = smalloc_strdup(f->file_name);
if (f->file_name) {
__f->file_name = smalloc_strdup(f->file_name);