Does nothing so far, but adds locking calls that cover from ->prep()
to after ->queue(). That is the period where we do IO.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
+void lock_file(struct thread_data *td, struct fio_file *f)
+{
+}
+
+void unlock_file(struct fio_file *f)
+{
+}
+
static int recurse_dir(struct thread_data *td, const char *dirname)
{
struct dirent *dir;
static int recurse_dir(struct thread_data *td, const char *dirname)
{
struct dirent *dir;
extern int add_file(struct thread_data *, const char *);
extern void get_file(struct fio_file *);
extern int __must_check put_file(struct thread_data *, struct fio_file *);
extern int add_file(struct thread_data *, const char *);
extern void get_file(struct fio_file *);
extern int __must_check put_file(struct thread_data *, struct fio_file *);
+extern void lock_file(struct thread_data *, struct fio_file *);
+extern void unlock_file(struct fio_file *);
extern int add_dir_files(struct thread_data *, const char *);
extern int init_random_map(struct thread_data *);
extern void dup_files(struct thread_data *, struct thread_data *);
extern int add_dir_files(struct thread_data *, const char *);
extern int init_random_map(struct thread_data *);
extern void dup_files(struct thread_data *, struct thread_data *);
* td_io_close() does a put_file() as well, so no need to
* do that here.
*/
* td_io_close() does a put_file() as well, so no need to
* do that here.
*/
+ unlock_file(io_u->file);
io_u->file = NULL;
td_io_close_file(td, f);
f->flags |= FIO_FILE_DONE;
io_u->file = NULL;
td_io_close_file(td, f);
f->flags |= FIO_FILE_DONE;
dprint_io_u(io_u, "prep");
fio_ro_check(td, io_u);
dprint_io_u(io_u, "prep");
fio_ro_check(td, io_u);
+ lock_file(td, io_u->file);
+
if (td->io_ops->prep) {
int ret = td->io_ops->prep(td, io_u);
dprint(FD_IO, "->prep(%p)=%d\n", io_u, ret);
if (td->io_ops->prep) {
int ret = td->io_ops->prep(td, io_u);
dprint(FD_IO, "->prep(%p)=%d\n", io_u, ret);
+ if (ret)
+ unlock_file(io_u->file);
ret = td->io_ops->queue(td, io_u);
ret = td->io_ops->queue(td, io_u);
+ unlock_file(io_u->file);
+
if (ret != FIO_Q_BUSY)
io_u_mark_depth(td, io_u);
if (ret != FIO_Q_BUSY)
io_u_mark_depth(td, io_u);