@@ -297,14 +297,13 @@ overwrite_ops_t prepare_ops_list(
297297 interval_set<uint64_t > pre_alloc_addr_removed, pre_alloc_addr_remapped;
298298 if (delta_based_overwrite_max_extent_size) {
299299 for (auto &r : ops.to_remove ) {
300- // TODO: Introduce LBAMapping::is_data_stable() to include EXIST_CLEAN extents
301- if (r->is_stable () && !r->is_zero_reserved ()) {
300+ if (r->is_data_stable () && !r->is_zero_reserved ()) {
302301 pre_alloc_addr_removed.insert (r->get_key (), r->get_length ());
303302
304303 }
305304 }
306305 for (auto &r : ops.to_remap ) {
307- if (r.pin && r.pin ->is_stable () && !r.pin ->is_zero_reserved ()) {
306+ if (r.pin && r.pin ->is_data_stable () && !r.pin ->is_zero_reserved ()) {
308307 pre_alloc_addr_remapped.insert (r.pin ->get_key (), r.pin ->get_length ());
309308 }
310309 }
@@ -641,8 +640,8 @@ struct overwrite_plan_t {
641640
642641 // helper member
643642 extent_len_t block_size;
644- bool is_left_stable ;
645- bool is_right_stable ;
643+ bool is_left_fresh ;
644+ bool is_right_fresh ;
646645
647646public:
648647 extent_len_t get_left_size () const {
@@ -692,8 +691,8 @@ struct overwrite_plan_t {
692691 << " , left_operation=" << overwrite_plan.left_operation
693692 << " , right_operation=" << overwrite_plan.right_operation
694693 << " , block_size=" << overwrite_plan.block_size
695- << " , is_left_stable =" << overwrite_plan.is_left_stable
696- << " , is_right_stable =" << overwrite_plan.is_right_stable
694+ << " , is_left_fresh =" << overwrite_plan.is_left_fresh
695+ << " , is_right_fresh =" << overwrite_plan.is_right_fresh
697696 << " )" ;
698697 }
699698
@@ -712,8 +711,10 @@ struct overwrite_plan_t {
712711 left_operation(overwrite_operation_t ::UNKNOWN),
713712 right_operation(overwrite_operation_t ::UNKNOWN),
714713 block_size(block_size),
715- is_left_stable(pins.front()->is_stable()),
716- is_right_stable(pins.back()->is_stable()) {
714+ // TODO: introduce PhysicalNodeMapping::is_fresh()
715+ // Note: fresh write can be merged with overwrite if they overlap.
716+ is_left_fresh(!pins.front()->is_stable()),
717+ is_right_fresh(!pins.back()->is_stable()) {
717718 validate ();
718719 evaluate_operations ();
719720 assert (left_operation != overwrite_operation_t ::UNKNOWN);
@@ -742,6 +743,9 @@ struct overwrite_plan_t {
742743 * seastore_obj_data_write_amplification; otherwise, split the
743744 * original extent into at most three parts: origin-left, part-to-be-modified
744745 * and origin-right.
746+ *
747+ * TODO: seastore_obj_data_write_amplification needs to be reconsidered because
748+ * delta-based overwrite is introduced
745749 */
746750 void evaluate_operations () {
747751 auto actual_write_size = get_pins_size ();
@@ -753,7 +757,7 @@ struct overwrite_plan_t {
753757 actual_write_size -= left_ext_size;
754758 left_ext_size = 0 ;
755759 left_operation = overwrite_operation_t ::OVERWRITE_ZERO;
756- } else if (!is_left_stable ) {
760+ } else if (is_left_fresh ) {
757761 aligned_data_size += left_ext_size;
758762 left_ext_size = 0 ;
759763 left_operation = overwrite_operation_t ::MERGE_EXISTING;
@@ -763,7 +767,7 @@ struct overwrite_plan_t {
763767 actual_write_size -= right_ext_size;
764768 right_ext_size = 0 ;
765769 right_operation = overwrite_operation_t ::OVERWRITE_ZERO;
766- } else if (!is_right_stable ) {
770+ } else if (is_right_fresh ) {
767771 aligned_data_size += right_ext_size;
768772 right_ext_size = 0 ;
769773 right_operation = overwrite_operation_t ::MERGE_EXISTING;
0 commit comments