Hello, I have been looking at the code used to update the weak references in OVS and would like to clarify what is the correct usage of the function assess_weak_refs(). This function is called inside for_each_txn_row(): ... while (t->n_processed < hmap_count(&t->txn_rows)) { ... assess_weak_refs() <- callback ...
The function for_each_txn_row() iterates internally calling on each cycle to assess_weak_refs() controlled by the counter hmap_count(&t->txn_rows) This counter represents the number of nodes currently in 'hmap'. This counter is incremented each time a row is processed inside assess_weak_refs() for rows deleted or modified in the original code. The call hierarchy used to update the hmap is shown: ovsdb_txn_row_modify() ovsdb_txn_row_create() hmap_insert() hmap_insert_at() hmap_insert_fast() ... hmap->n++; What the code is apparently doing... 1. In the case a row has been deleted assess_weak_refs() enters and modify the rows with references to the row that has been deleted and exit. These rows are now in the hmap. 2. For each of the modified rows (which have weak references to the deleted row), a. Run assess_weak_refs() and modify rows that have weak references to this row. [dst_refs are the weak references to current row] *** i. ovsdb_table_get_row() checks for rows in the hmap matching a uuid and if the row exists a weak reference is added. The implementation modifies the rows with weak references using: if (txn_row->old) { ... LIST_FOR_EACH_SAFE (weak, next, dst_node, &txn_row->old->dst_refs) { ... but it evaluates deleted or modified rows. ***When a row has been deleted, the rows with weak references (*) to it get modified and its weak references updated. But this produces that the rows with weak references to the rows in (*) get also updated, and so on. Could the weak references be updated after modifying *only* the rows with weak references to the deleted row, or is it required that all dependent rows get updated? Is this the expected behavior of this function? Regards, Randall Esquivel _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev