From: Jens Axboe Date: Fri, 4 Jul 2014 00:01:11 +0000 (-0600) Subject: iolog: use a define instead of a raw bit mask X-Git-Tag: fio-2.1.11~16 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=49e98daa3e1d46c13b570ab3676a22ac849fc4c0 iolog: use a define instead of a raw bit mask Add a comment too, while in there. Signed-off-by: Jens Axboe --- diff --git a/iolog.c b/iolog.c index c3b42b3b..8bfd5bcf 100644 --- a/iolog.c +++ b/iolog.c @@ -565,7 +565,7 @@ void setup_log(struct io_log **log, struct log_params *p, l->td = p->td; if (l->log_offset) - l->log_ddir_mask = 0x80000000; + l->log_ddir_mask = LOG_OFFSET_SAMPLE_BIT; INIT_FLIST_HEAD(&l->chunk_list); @@ -622,10 +622,7 @@ static void flush_samples(FILE *f, void *samples, uint64_t sample_size) return; s = __get_sample(samples, 0, 0); - if (s->__ddir & 0x80000000) - log_offset = 1; - else - log_offset = 0; + log_offset = (s->__ddir & LOG_OFFSET_SAMPLE_BIT) != 0; nr_samples = sample_size / __log_entry_sz(log_offset); diff --git a/iolog.h b/iolog.h index d268fe2e..fcd67942 100644 --- a/iolog.h +++ b/iolog.h @@ -93,7 +93,11 @@ struct io_log { struct flist_head chunk_list; }; -#define io_sample_ddir(io) ((io)->__ddir & ~0x80000000U) +/* + * 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,