+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)
+{
+ return samples + sample * __log_entry_sz(log_offset);
+}
+
+static inline struct io_sample *get_sample(struct io_log *iolog,
+ uint64_t sample)
+{
+ return __get_sample(iolog->log, iolog->log_offset, sample);
+}
+