> + if (tail_cycle == head_cycle && head_bytes >= tail_bytes) { > + return log->l_logsize - (head_bytes - tail_bytes); > + } else if (tail_cycle + 1 < head_cycle) { > return 0; > + } else if (xlog_is_shutdown(log)) { > + /* Ignore potential inconsistency when shutdown. */ > + return log->l_logsize; > + } else if (tail_cycle < head_cycle) { > ASSERT(tail_cycle == (head_cycle - 1)); > + return tail_bytes - head_bytes; > } Drop the else after the returns to make this a little easier to follow: if (tail_cycle == head_cycle && head_bytes >= tail_bytes) return log->l_logsize - (head_bytes - tail_bytes); if (tail_cycle + 1 < head_cycle) return 0; /* Ignore potential inconsistency when shutdown. */ if (xlog_is_shutdown(log)) { return log->l_logsize; if (tail_cycle < head_cycle) { ASSERT(tail_cycle == (head_cycle - 1)); return tail_bytes - head_bytes; } Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@xxxxxx>