Add a comment too, while in there.
Signed-off-by: Jens Axboe <axboe@fb.com>
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);
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);
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,