From 86139cf6bd7826241e7cb81e4a9bea2f8ef6e761 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Thu, 28 May 2020 13:38:48 +0800 Subject: [PATCH] [sm_recursive] Fix atomicity when applying BOPs Any BOP should be taken only once. Therefore, we should remove BOPs that are being processed or had been processed from the uncommitted list. --- persistent-data/space-maps/recursive.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/persistent-data/space-maps/recursive.cc b/persistent-data/space-maps/recursive.cc index 0977e61..a6643da 100644 --- a/persistent-data/space-maps/recursive.cc +++ b/persistent-data/space-maps/recursive.cc @@ -212,9 +212,11 @@ namespace { void flush_ops_() { recursing_lock lock(*this); - for (auto const &p : ops_) { - block_address b = p.first; - auto const &op = p.second; + while (!ops_.empty()) { + auto p = ops_.begin(); + block_address b = p->first; + auto op = p->second; + ops_.erase(p); switch (op.op_) { case INC: @@ -230,7 +232,6 @@ namespace { } } - ops_.clear(); allocated_blocks_.clear(); }