+ /*
+ * Entries already logged
+ */
+ uint64_t nr_samples;
+ uint64_t max_samples;
+ void *log;
+
+ unsigned int log_ddir_mask;
+
+ char *filename;
+
+ struct thread_data *td;
+
+ unsigned int log_type;
+
+ /*
+ * If we fail extending the log, stop collecting more entries.
+ */
+ unsigned int disabled;
+
+ /*
+ * Log offsets
+ */
+ unsigned int log_offset;
+
+ /*
+ * Max size of log entries before a chunk is compressed
+ */
+ unsigned int log_gz;
+
+ /*
+ * Don't deflate for storing, just store the compressed bits
+ */
+ unsigned int log_gz_store;
+
+ /*
+ * Windowed average, for logging single entries average over some
+ * period of time.
+ */
+ struct io_stat avg_window[DDIR_RWDIR_CNT];
+ unsigned long avg_msec;
+ unsigned long avg_last;
+
+ pthread_mutex_t chunk_lock;
+ unsigned int chunk_seq;
+ struct flist_head chunk_list;
+};
+
+/*
+ * If the upper bit is set, then we have the offset as well
+ */
+#define LOG_OFFSET_SAMPLE_BIT 0x80000000U
+#define io_sample_ddir(io) ((io)->__ddir & ~LOG_OFFSET_SAMPLE_BIT)
+
+static inline void io_sample_set_ddir(struct io_log *log,
+ struct io_sample *io,
+ enum fio_ddir ddir)
+{
+ io->__ddir = ddir | log->log_ddir_mask;
+}
+
+static inline size_t __log_entry_sz(int log_offset)
+{
+ if (log_offset)
+ return sizeof(struct io_sample_offset);
+ else
+ return sizeof(struct io_sample);
+}
+
+static inline size_t log_entry_sz(struct io_log *log)
+{
+ return __log_entry_sz(log->log_offset);
+}
+
+static inline struct io_sample *__get_sample(void *samples, int log_offset,
+ uint64_t sample)
+{
+ uint64_t sample_offset = sample * __log_entry_sz(log_offset);
+ return (struct io_sample *) ((char *) samples + sample_offset);
+}
+
+static inline struct io_sample *get_sample(struct io_log *iolog,
+ uint64_t sample)
+{
+ return __get_sample(iolog->log, iolog->log_offset, sample);
+}
+
+enum {
+ IP_F_ONRB = 1,
+ IP_F_ONLIST = 2,
+ IP_F_TRIMMED = 4,
+ IP_F_IN_FLIGHT = 8,