lib/cmap.c
/* Inserts 'node', with the given 'hash', into 'cmap'.  The caller must ensure
 * that 'cmap' cannot change concurrently (from another thread).  If duplicates
 * are undesirable, the caller must have already verified that 'cmap' does not
 * contain a duplicate of 'node'.
 *
 * Returns the current number of nodes in the cmap after the insertion. */


Returns the current number of nodes in the cmap after the insertion.
Returns the current number of nodes in the cmap after the insertion .
size_t
cmap_insert(struct cmap *cmap, struct cmap_node *node, uint32_t hash)
{
    struct cmap_impl *impl = cmap_get_impl(cmap);
    ovsrcu_set_hidden(&node->next, NULL);
    if (OVS_UNLIKELY(impl->n >= impl->max_n)) {
        COVERAGE_INC(cmap_expand);
        impl = cmap_rehash(cmap, (impl->mask << 1) | 1);
    }
    while (OVS_UNLIKELY(!cmap_try_insert(impl, node, hash))) {
        impl = cmap_rehash(cmap, impl->mask);
    }
    return ++impl->n;
}
size_t cmap_insert ( struct cmap * cmap , struct cmap_node * node , uint32_t hash ) { struct cmap_impl * impl = cmap_get_impl ( cmap ) ; ovsrcu_set_hidden ( & node -> next , NULL ) ; if ( OVS_UNLIKELY ( impl -> n >= impl -> max_n ) ) { COVERAGE_INC ( cmap_expand ) ; impl = cmap_rehash ( cmap , ( impl -> mask << 1 ) | 1 ) ; } while ( OVS_UNLIKELY ( ! cmap_try_insert ( impl , node , hash ) ) ) { impl = cmap_rehash ( cmap , impl -> mask ) ; } return ++ impl -> n ; }
Inserts 'node', with the given 'hash', into 'cmap'.
Inserts ' node ' with the given ' hash ' into ' cmap ' .