CircularBoundedJournal is similar to circular queue, so segment_seq
increases after rolling. However, current implementation always
increases segment_seq_t when rolling occurs, resulting in
the overflow if segment_seq_t hits MAX_SEG_SEQ.
To mitigate this, this commit changes the type of the segment_seq_t
to uint64_t.
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
(cherry picked from commit
36982b66574ff277e04a02d5b9a28e80d0790778)
get_records_start(),
get_device_id());
auto seq = get_written_to();
+ seq.segment_seq++;
+ assert(seq.segment_seq < MAX_SEG_SEQ);
set_written_to(
- journal_seq_t{++seq.segment_seq, paddr});
+ journal_seq_t{seq.segment_seq, paddr});
return roll_ertr::now();
}
/* Monotonically increasing segment seq, uniquely identifies
* the incarnation of a segment */
-using segment_seq_t = uint32_t;
+using segment_seq_t = uint64_t;
static constexpr segment_seq_t MAX_SEG_SEQ =
std::numeric_limits<segment_seq_t>::max();
static constexpr segment_seq_t NULL_SEG_SEQ = MAX_SEG_SEQ;