Lines Matching +full:two +full:- +full:dimensional
1 // SPDX-License-Identifier: GPL-2.0-only
6 #include "index-page-map.h"
10 #include "memory-alloc.h"
13 #include "string-utils.h"
14 #include "thread-utils.h"
16 #include "hash-utils.h"
20 * The index page map is conceptually a two-dimensional array indexed by chapter number and index
28 #define PAGE_MAP_MAGIC_LENGTH (sizeof(PAGE_MAP_MAGIC) - 1)
32 return geometry->chapters_per_volume * (geometry->index_pages_per_chapter - 1); in get_entry_count()
45 map->geometry = geometry; in uds_make_index_page_map()
46 map->entries_per_chapter = geometry->index_pages_per_chapter - 1; in uds_make_index_page_map()
48 &map->entries); in uds_make_index_page_map()
61 vdo_free(map->entries); in uds_free_index_page_map()
72 map->last_update = virtual_chapter_number; in uds_update_index_page_map()
73 if (index_page_number == map->entries_per_chapter) in uds_update_index_page_map()
76 slot = (chapter_number * map->entries_per_chapter) + index_page_number; in uds_update_index_page_map()
77 map->entries[slot] = delta_list_number; in uds_update_index_page_map()
83 u32 delta_list_number = uds_hash_to_chapter_delta_list(name, map->geometry); in uds_find_index_page_number()
84 u32 slot = chapter_number * map->entries_per_chapter; in uds_find_index_page_number()
87 for (page = 0; page < map->entries_per_chapter; page++) { in uds_find_index_page_number()
88 if (delta_list_number <= map->entries[slot + page]) in uds_find_index_page_number()
99 u32 slot = chapter_number * map->entries_per_chapter; in uds_get_list_number_bounds()
102 0 : map->entries[slot + index_page_number - 1] + 1); in uds_get_list_number_bounds()
103 *highest_list = ((index_page_number < map->entries_per_chapter) ? in uds_get_list_number_bounds()
104 map->entries[slot + index_page_number] : in uds_get_list_number_bounds()
105 map->geometry->delta_lists_per_chapter - 1); in uds_get_list_number_bounds()
118 u64 saved_size = uds_compute_index_page_map_save_size(map->geometry); in uds_write_index_page_map()
127 encode_u64_le(buffer, &offset, map->last_update); in uds_write_index_page_map()
128 for (i = 0; i < get_entry_count(map->geometry); i++) in uds_write_index_page_map()
129 encode_u16_le(buffer, &offset, map->entries[i]); in uds_write_index_page_map()
145 u64 saved_size = uds_compute_index_page_map_save_size(map->geometry); in uds_read_index_page_map()
165 decode_u64_le(buffer, &offset, &map->last_update); in uds_read_index_page_map()
166 for (i = 0; i < get_entry_count(map->geometry); i++) in uds_read_index_page_map()
167 decode_u16_le(buffer, &offset, &map->entries[i]); in uds_read_index_page_map()
171 (unsigned long long) map->last_update); in uds_read_index_page_map()