[ovs-dev] [gc 12/13] ovsdb: Don't count self-references in ovsdb_row's n_refs member.

Ethan Jackson ethan at nicira.com
Fri Mar 4 22:42:34 UTC 2011


Looks Good.

On Tue, Mar 1, 2011 at 2:19 PM, Ben Pfaff <blp at nicira.com> wrote:
> The comment on the n_refs member of struct ovsdb_row says that it does not
> count references from a row to itself, but the code didn't implement this
> properly.  This commit makes the code consistent with the comment.
>
> This does not actually affect any existing OVSDB behavior, because a row's
> reference count currently affects only whether it may be deleted, and
> references from a row to itself disappear when the row is deleted.  But
> an upcoming commit will add new uses for a row's reference count, so at
> that point it becomes important.
> ---
>  ovsdb/transaction.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
> index f67018b..615c164 100644
> --- a/ovsdb/transaction.c
> +++ b/ovsdb/transaction.c
> @@ -176,6 +176,10 @@ ovsdb_txn_adjust_atom_refs(struct ovsdb_txn *txn, const struct ovsdb_row *r,
>     for (i = 0; i < n; i++) {
>         const struct uuid *uuid = &atoms[i].uuid;
>         struct ovsdb_txn_row *txn_row = find_txn_row(table, uuid);
> +        if (uuid_equals(uuid, ovsdb_row_get_uuid(r))) {
> +            /* Self-references don't count. */
> +            continue;
> +        }
>         if (!txn_row) {
>             const struct ovsdb_row *row = ovsdb_table_get_row(table, uuid);
>             if (row) {
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>




More information about the dev mailing list