[ovs-dev] [Partial-Update-Map-Columns 1/7] Add Initial code for Partial-map-columns functionality

Lutz, Arnoldo arnoldo.lutz.guevara at hpe.com
Mon Feb 22 19:58:22 UTC 2016


This commit adds some definitions and skeleton functions to start working.
Ovsdb tests run and pass ok.

Signed-off-by: arnoldo.lutz.guevara at hpe.com <arnoldo.lutz.guevara at hpe.com>
---
2	0	lib/ovsdb-idl-provider.h
31	3	lib/ovsdb-idl.c
7	0	lib/ovsdb-idl.h
 lib/ovsdb-idl-provider.h |  2 ++
 lib/ovsdb-idl.c          | 34 +++++++++++++++++++++++++++++++---
 lib/ovsdb-idl.h          |  7 +++++++
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index 190acca..96a9ba8 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -41,6 +41,8 @@ struct ovsdb_idl_row {
     unsigned int change_seqno[OVSDB_IDL_CHANGE_MAX];
     struct ovs_list track_node; /* Rows modified/added/deleted by IDL */
     unsigned long int *updated; /* Bitmap of columns updated by IDL */
+
+    unsigned long int *partial_maps; /* Bitmap of columns containing partial maps */
 };
 
 struct ovsdb_idl_column {
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 4cb1c81..28ebdb3 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -2524,7 +2524,8 @@ ovsdb_idl_txn_complete(struct ovsdb_idl_txn *txn,
 static void
 ovsdb_idl_txn_write__(const struct ovsdb_idl_row *row_,
                       const struct ovsdb_idl_column *column,
-                      struct ovsdb_datum *datum, bool owns_datum)
+                      struct ovsdb_datum *datum, bool owns_datum,
+                      bool partial_map)
 {
     struct ovsdb_idl_row *row = CONST_CAST(struct ovsdb_idl_row *, row_);
     const struct ovsdb_idl_table_class *class;
@@ -2581,6 +2582,12 @@ ovsdb_idl_txn_write__(const struct ovsdb_idl_row *row_,
     } else {
         bitmap_set1(row->written, column_idx);
     }
+    /* If the datum contains a partial map of the column, set the corresponding
+     * bit in the bitmap so it can be handle accordingly in ovsdb_idl_txn_commit
+     */
+    if (partial_map) {
+        bitmap_set1(row->partial_maps, column_idx);
+    }
     if (owns_datum) {
         row->new[column_idx] = *datum;
     } else {
@@ -2601,7 +2608,7 @@ ovsdb_idl_txn_write(const struct ovsdb_idl_row *row,
                     const struct ovsdb_idl_column *column,
                     struct ovsdb_datum *datum)
 {
-    ovsdb_idl_txn_write__(row, column, datum, true);
+    ovsdb_idl_txn_write__(row, column, datum, true, false);
 }
 
 void
@@ -2610,7 +2617,7 @@ ovsdb_idl_txn_write_clone(const struct ovsdb_idl_row *row,
                           const struct ovsdb_datum *datum)
 {
     ovsdb_idl_txn_write__(row, column,
-                          CONST_CAST(struct ovsdb_datum *, datum), false);
+                          CONST_CAST(struct ovsdb_datum *, datum), false, false);
 }
 
 /* Causes the original contents of 'column' in 'row_' to be verified as a
@@ -3197,3 +3204,24 @@ ovsdb_idl_loop_commit_and_wait(struct ovsdb_idl_loop *loop)
 
     ovsdb_idl_wait(loop->idl);
 }
+
+/* Skeleton functions needed to handle partial for map_columns
+ * This functions must be moved to a better place when finished implementation
+ *
+ */
+void
+ovsdb_idl_txn_write_partial_map(const struct ovsdb_idl_row *row,
+                                const struct ovsdb_idl_column *column,
+                                struct ovsdb_datum *datum)
+{
+    ovsdb_idl_txn_write__(row, column, datum, true, true);
+}
+
+void
+ovsdb_idl_txn_delete_partial_map(const struct ovsdb_idl_row *row,
+                                const struct ovsdb_idl_column *column,
+                                struct ovsdb_datum *datum)
+{
+    return;
+}
+
diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h
index 136c38c..9b8df57 100644
--- a/lib/ovsdb-idl.h
+++ b/lib/ovsdb-idl.h
@@ -249,7 +249,14 @@ void ovsdb_idl_txn_write(const struct ovsdb_idl_row *,
 void ovsdb_idl_txn_write_clone(const struct ovsdb_idl_row *,
                                const struct ovsdb_idl_column *,
                                const struct ovsdb_datum *);
+void ovsdb_idl_txn_write_partial_map(const struct ovsdb_idl_row *,
+                                const struct ovsdb_idl_column *,
+                                struct ovsdb_datum *);
+void ovsdb_idl_txn_delete_partial_map(const struct ovsdb_idl_row *,
+                                const struct ovsdb_idl_column *,
+                                struct ovsdb_datum *);
 void ovsdb_idl_txn_delete(const struct ovsdb_idl_row *);
+
 const struct ovsdb_idl_row *ovsdb_idl_txn_insert(
     struct ovsdb_idl_txn *, const struct ovsdb_idl_table_class *,
     const struct uuid *);
-- 
1.9.1



More information about the dev mailing list