Home | History | Annotate | Download | only in block

Lines Matching refs:nb_clusters

293 static int count_contiguous_clusters(uint64_t nb_clusters, int cluster_size,
302 for (i = start; i < start + nb_clusters; i++)
309 static int count_contiguous_free_clusters(uint64_t nb_clusters, uint64_t *l2_table)
313 while(nb_clusters-- && l2_table[i] == 0)
447 unsigned int index_in_cluster, nb_clusters;
497 nb_clusters = size_to_clusters(s, nb_needed << 9);
501 c = count_contiguous_free_clusters(nb_clusters, &l2_table[l2_index]);
504 c = count_contiguous_clusters(nb_clusters, s->cluster_size,
674 if (m->nb_clusters == 0)
677 old_cluster = qemu_malloc(m->nb_clusters * sizeof(uint64_t));
701 for (i = 0; i < m->nb_clusters; i++) {
715 ret = write_l2_entries(bs, l2_table, l2_offset, l2_index, m->nb_clusters);
737 * If the cluster was already allocated, m->nb_clusters is set to 0,
740 * If the cluster is newly allocated, m->nb_clusters is set to the number of
745 * If m->nb_clusters is non-zero, the other fields of m are valid and contain
757 unsigned int nb_clusters, i = 0;
765 nb_clusters = size_to_clusters(s, n_end << 9);
767 nb_clusters = MIN(nb_clusters, s->l2_size - l2_index);
774 nb_clusters = count_contiguous_clusters(nb_clusters, s->cluster_size,
778 m->nb_clusters = 0;
787 nb_clusters = 1;
791 while (i < nb_clusters) {
792 i += count_contiguous_clusters(nb_clusters - i, s->cluster_size,
794 if ((i >= nb_clusters) || be64_to_cpu(l2_table[l2_index + i])) {
798 i += count_contiguous_free_clusters(nb_clusters - i,
800 if (i >= nb_clusters) {
810 assert(i <= nb_clusters);
811 nb_clusters = i;
820 uint64_t end_offset = offset + nb_clusters * s->cluster_size;
823 old_alloc->nb_clusters * s->cluster_size;
830 nb_clusters = (old_offset - offset) >> s->cluster_bits;
832 nb_clusters = 0;
835 if (nb_clusters == 0) {
838 m->nb_clusters = 0;
845 if (!nb_clusters) {
853 cluster_offset = qcow2_alloc_clusters(bs, nb_clusters * s->cluster_size);
862 m->nb_clusters = nb_clusters;
865 m->nb_available = MIN(nb_clusters << (s->cluster_bits - 9), n_end);