Constify 'td' in a few functions
authorJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 19:29:57 +0000 (13:29 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 19:29:57 +0000 (13:29 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
fio.h
io_u.c
io_u_queue.h
ioengine.h
ioengines.c

diff --git a/fio.h b/fio.h
index 136b43089285e1887a417c60d8f63a3d635e1176..f981739e8fc261285056da4bdc65a50bc8757fdb 100644 (file)
--- 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 9adc31bf04d1ce3cbaaaa2ddaa94e6b7f4dcb569..612057d15762dfa13e7e48bc48e99658f9e8880a 100644 (file)
--- 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);
 
index b702b1f3987578079ad67d42908feaf8f1093a79..bda40d5ea263920055f6d75c62bdca8e4559034c 100644 (file)
@@ -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;
 }
index 108c97cd0b93a629607d264ca711748967b3b536..0742a8b96753c3bf79edb431c2bd63ee27a46df2 100644 (file)
@@ -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)
index 3010f6c146c4dbbcf0f9d191d0f44f22dfaa46d2..56149381894abfb56e9bd7a47368cc2773278fde 100644 (file)
@@ -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;