From caa20ee59240348c33284f56b72e4f8aeb4044ac Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Fri, 22 Mar 2024 10:21:56 -0400 Subject: [PATCH] engines/fileoperations: use local var for ioengine data Improve code readability by using a local variable for ioengine data. Signed-off-by: Vincent Fu --- engines/fileoperations.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/fileoperations.c b/engines/fileoperations.c index 58a81496..c52f0900 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"); -- 2.25.1