diff options
author | Vincent Fu <vincent.fu@samsung.com> | 2024-03-22 10:21:56 -0400 |
---|---|---|
committer | Vincent Fu <vincent.fu@samsung.com> | 2024-03-22 10:21:56 -0400 |
commit | caa20ee59240348c33284f56b72e4f8aeb4044ac (patch) | |
tree | 7e71a31f4df3b465ed54a34376c227b6c3348b57 | |
parent | 2dee6cc12677c4cac7ce7e247bcb172cbd110895 (diff) | |
download | fio-caa20ee59240348c33284f56b72e4f8aeb4044ac.tar.gz |
engines/fileoperations: use local var for ioengine data
Improve code readability by using a local variable for ioengine data.
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
-rw-r--r-- | engines/fileoperations.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/fileoperations.c b/engines/fileoperations.c index 58a814963..c52f09004 100644 --- a/engines/fileoperations.c +++ b/engines/fileoperations.c @@ -90,6 +90,7 @@ static int open_file(struct thread_data *td, struct fio_file *f) { struct timespec start; int do_lat = !td->o.disable_lat; + struct fc_data *fcd = td->io_ops_data; dprint(FD_FILE, "fd open %s\n", f->file_name); @@ -105,9 +106,9 @@ static int open_file(struct thread_data *td, struct fio_file *f) if (do_lat) fio_gettime(&start, NULL); - if (((struct fc_data *)td->io_ops_data)->op_engine == FILE_OP_ENGINE) + if (fcd->op_engine == FILE_OP_ENGINE) f->fd = open(f->file_name, O_CREAT|O_RDWR, 0600); - else if (((struct fc_data *)td->io_ops_data)->op_engine == DIR_OP_ENGINE) + else if (fcd->op_engine == DIR_OP_ENGINE) f->fd = fio_mkdir(f->file_name, S_IFDIR); else { log_err("fio: unknown file/directory operation engine\n"); @@ -209,6 +210,7 @@ static int delete_file(struct thread_data *td, struct fio_file *f) { struct timespec start; int do_lat = !td->o.disable_lat; + struct fc_data *fcd = td->io_ops_data; int ret; dprint(FD_FILE, "fd delete %s\n", f->file_name); @@ -225,9 +227,9 @@ static int delete_file(struct thread_data *td, struct fio_file *f) if (do_lat) fio_gettime(&start, NULL); - if (((struct fc_data *)td->io_ops_data)->op_engine == FILE_OP_ENGINE) + if (fcd->op_engine == FILE_OP_ENGINE) ret = unlink(f->file_name); - else if (((struct fc_data *)td->io_ops_data)->op_engine == DIR_OP_ENGINE) + else if (fcd->op_engine == DIR_OP_ENGINE) ret = rmdir(f->file_name); else { log_err("fio: unknown file/directory operation engine\n"); |