From effd6ff0d9f701a64d6bc46509eedfdcfd12f553 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 30 Sep 2014 13:29:57 -0600 Subject: [PATCH] Constify 'td' in a few functions Signed-off-by: Jens Axboe --- fio.h | 2 +- io_u.c | 2 +- io_u_queue.h | 2 +- ioengine.h | 6 +++--- ioengines.c | 7 ++++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fio.h b/fio.h index 136b4308..f981739e 100644 --- a/fio.h +++ b/fio.h @@ -406,7 +406,7 @@ extern const char fio_version_string[]; extern struct thread_data *threads; -static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u) +static inline void fio_ro_check(const struct thread_data *td, struct io_u *io_u) { assert(!(io_u->ddir == DDIR_WRITE && !td_write(td))); } diff --git a/io_u.c b/io_u.c index 9adc31bf..612057d1 100644 --- a/io_u.c +++ b/io_u.c @@ -1301,7 +1301,7 @@ void lat_target_check(struct thread_data *td) * If latency target is enabled, we might be ramping up or down and not * using the full queue depth available. */ -int queue_full(struct thread_data *td) +int queue_full(const struct thread_data *td) { const int qempty = io_u_qempty(&td->io_u_freelist); diff --git a/io_u_queue.h b/io_u_queue.h index b702b1f3..bda40d5e 100644 --- a/io_u_queue.h +++ b/io_u_queue.h @@ -28,7 +28,7 @@ static inline void io_u_qpush(struct io_u_queue *q, struct io_u *io_u) q->io_us[q->nr++] = io_u; } -static inline int io_u_qempty(struct io_u_queue *q) +static inline int io_u_qempty(const struct io_u_queue *q) { return !q->nr; } diff --git a/ioengine.h b/ioengine.h index 108c97cd..0742a8b9 100644 --- a/ioengine.h +++ b/ioengine.h @@ -215,10 +215,10 @@ extern void fill_io_buffer(struct thread_data *, void *, unsigned int, unsigned extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int, unsigned int); void io_u_mark_complete(struct thread_data *, unsigned int); void io_u_mark_submit(struct thread_data *, unsigned int); -int queue_full(struct thread_data *); +int queue_full(const struct thread_data *); -int do_io_u_sync(struct thread_data *, struct io_u *); -int do_io_u_trim(struct thread_data *, struct io_u *); +int do_io_u_sync(const struct thread_data *, struct io_u *); +int do_io_u_trim(const struct thread_data *, struct io_u *); #ifdef FIO_INC_DEBUG static inline void dprint_io_u(struct io_u *io_u, const char *p) diff --git a/ioengines.c b/ioengines.c index 3010f6c1..56149381 100644 --- a/ioengines.c +++ b/ioengines.c @@ -522,7 +522,8 @@ int td_io_get_file_size(struct thread_data *td, struct fio_file *f) return td->io_ops->get_file_size(td, f); } -static int do_sync_file_range(struct thread_data *td, struct fio_file *f) +static int do_sync_file_range(const struct thread_data *td, + struct fio_file *f) { off64_t offset, nbytes; @@ -535,7 +536,7 @@ static int do_sync_file_range(struct thread_data *td, struct fio_file *f) return sync_file_range(f->fd, offset, nbytes, td->o.sync_file_range); } -int do_io_u_sync(struct thread_data *td, struct io_u *io_u) +int do_io_u_sync(const struct thread_data *td, struct io_u *io_u) { int ret; @@ -561,7 +562,7 @@ int do_io_u_sync(struct thread_data *td, struct io_u *io_u) return ret; } -int do_io_u_trim(struct thread_data *td, struct io_u *io_u) +int do_io_u_trim(const struct thread_data *td, struct io_u *io_u) { #ifndef FIO_HAVE_TRIM io_u->error = EINVAL; -- 2.25.1