Constify 'td' in a few functions
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/fio.h b/fio.h
index 136b430..f981739 100644
--- a/fio.h
+++ b/fio.h
@@ -406,7 +406,7 @@
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 9adc31b..612057d 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1301,7 +1301,7 @@
* 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 b702b1f..bda40d5 100644
--- a/io_u_queue.h
+++ b/io_u_queue.h
@@ -28,7 +28,7 @@
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 108c97c..0742a8b 100644
--- a/ioengine.h
+++ b/ioengine.h
@@ -215,10 +215,10 @@
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 3010f6c..5614938 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -522,7 +522,8 @@
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 @@
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 @@
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;