Lines Matching refs:l2_index
398 int l1_index, l2_index; in qcow2_get_cluster_offset() local
446 l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1); in qcow2_get_cluster_offset()
447 cluster_offset = be64_to_cpu(l2_table[l2_index]); in qcow2_get_cluster_offset()
452 c = count_contiguous_free_clusters(nb_clusters, &l2_table[l2_index]); in qcow2_get_cluster_offset()
456 &l2_table[l2_index], 0, QCOW_OFLAG_COPIED); in qcow2_get_cluster_offset()
486 int l1_index, l2_index, ret; in get_cluster_table() local
518 l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1); in get_cluster_table()
522 *new_l2_index = l2_index; in get_cluster_table()
545 int l2_index, ret; in qcow2_alloc_compressed_cluster_offset() local
549 ret = get_cluster_table(bs, offset, &l2_table, &l2_offset, &l2_index); in qcow2_alloc_compressed_cluster_offset()
553 cluster_offset = be64_to_cpu(l2_table[l2_index]); in qcow2_alloc_compressed_cluster_offset()
571 l2_table[l2_index] = cpu_to_be64(cluster_offset); in qcow2_alloc_compressed_cluster_offset()
573 l2_offset + l2_index * sizeof(uint64_t), in qcow2_alloc_compressed_cluster_offset()
574 l2_table + l2_index, in qcow2_alloc_compressed_cluster_offset()
587 uint64_t l2_offset, int l2_index, int num) in write_l2_entries() argument
589 int l2_start_index = l2_index & ~(L1_ENTRIES_PER_SECTOR - 1); in write_l2_entries()
590 int start_offset = (8 * l2_index) & ~511; in write_l2_entries()
591 int end_offset = (8 * (l2_index + num) + 511) & ~511; in write_l2_entries()
607 int i, j = 0, l2_index, ret; in qcow2_alloc_cluster_link_l2() local
633 if (!get_cluster_table(bs, m->offset, &l2_table, &l2_offset, &l2_index)) in qcow2_alloc_cluster_link_l2()
643 if(l2_table[l2_index + i] != 0) in qcow2_alloc_cluster_link_l2()
644 old_cluster[j++] = l2_table[l2_index + i]; in qcow2_alloc_cluster_link_l2()
646 l2_table[l2_index + i] = cpu_to_be64((cluster_offset + in qcow2_alloc_cluster_link_l2()
650 if (write_l2_entries(s, l2_table, l2_offset, l2_index, m->nb_clusters) < 0) { in qcow2_alloc_cluster_link_l2()
684 int l2_index, ret; in qcow2_alloc_cluster_offset() local
688 ret = get_cluster_table(bs, offset, &l2_table, &l2_offset, &l2_index); in qcow2_alloc_cluster_offset()
694 nb_clusters = MIN(nb_clusters, s->l2_size - l2_index); in qcow2_alloc_cluster_offset()
696 cluster_offset = be64_to_cpu(l2_table[l2_index]); in qcow2_alloc_cluster_offset()
702 &l2_table[l2_index], 0, 0); in qcow2_alloc_cluster_offset()
719 &l2_table[l2_index], i, 0); in qcow2_alloc_cluster_offset()
721 if(be64_to_cpu(l2_table[l2_index + i])) in qcow2_alloc_cluster_offset()
725 &l2_table[l2_index + i]); in qcow2_alloc_cluster_offset()
727 cluster_offset = be64_to_cpu(l2_table[l2_index + i]); in qcow2_alloc_cluster_offset()