bool qht_reset_size(struct qht *ht, size_t n_elems)

{

    struct qht_map *new;

    struct qht_map *map;

    size_t n_buckets;

    bool resize = false;



    n_buckets = qht_elems_to_buckets(n_elems);



    qemu_mutex_lock(&ht->lock);

    map = ht->map;

    if (n_buckets != map->n_buckets) {

        new = qht_map_create(n_buckets);

        resize = true;

    }



    qht_map_lock_buckets(map);

    qht_map_reset__all_locked(map);

    if (resize) {

        qht_do_resize(ht, new);

    }

    qht_map_unlock_buckets(map);

    qemu_mutex_unlock(&ht->lock);



    return resize;

}

bool qht_reset_size(struct qht *ht, size_t n_elems)

{

    struct qht_map *new;

    struct qht_map *map;

    size_t n_buckets;

    bool resize = false;



    n_buckets = qht_elems_to_buckets(n_elems);



    qemu_mutex_lock(&ht->lock);

    map = ht->map;

    if (n_buckets != map->n_buckets) {

        new = qht_map_create(n_buckets);

        resize = true;

    }



    qht_map_lock_buckets(map);

    qht_map_reset__all_locked(map);

    if (resize) {

        qht_do_resize(ht, new);

    }

    qht_map_unlock_buckets(map);

    qemu_mutex_unlock(&ht->lock);



    return resize;

}

bool FUNC_0(struct qht *ht, size_t n_elems)

{

    struct qht_map *VAR_0;

    struct qht_map *VAR_1;

    size_t n_buckets;

    bool resize = false;



    n_buckets = qht_elems_to_buckets(n_elems);



    qemu_mutex_lock(&ht->lock);

    VAR_1 = ht->VAR_1;

    if (n_buckets != VAR_1->n_buckets) {

        VAR_0 = qht_map_create(n_buckets);

        resize = true;

    }



    qht_map_lock_buckets(VAR_1);

    qht_map_reset__all_locked(VAR_1);

    if (resize) {

        qht_do_resize(ht, VAR_0);

    }

    qht_map_unlock_buckets(VAR_1);

    qemu_mutex_unlock(&ht->lock);



    return resize;

}

bool FUNC_0(struct qht *ht, size_t n_elems)
{ struct qht_map *VAR_0; struct qht_map *VAR_1; size_t n_buckets; bool resize = false; n_buckets = qht_elems_to_buckets(n_elems); qemu_mutex_lock(&ht->lock); VAR_1 = ht->VAR_1; if (n_buckets != VAR_1->n_buckets) { VAR_0 = qht_map_create(n_buckets); resize = true; } qht_map_lock_buckets(VAR_1); qht_map_reset__all_locked(VAR_1); if (resize) { qht_do_resize(ht, VAR_0); } qht_map_unlock_buckets(VAR_1); qemu_mutex_unlock(&ht->lock); return resize; }