Lines Matching refs:open_chapter
53 static inline size_t records_size(const struct open_chapter_zone *open_chapter) in records_size() argument
55 return sizeof(struct uds_volume_record) * (1 + open_chapter->capacity); in records_size()
67 struct open_chapter_zone *open_chapter; in uds_make_open_chapter() local
73 &open_chapter); in uds_make_open_chapter()
77 open_chapter->slot_count = slot_count; in uds_make_open_chapter()
78 open_chapter->capacity = capacity; in uds_make_open_chapter()
79 result = vdo_allocate_cache_aligned(records_size(open_chapter), "record pages", in uds_make_open_chapter()
80 &open_chapter->records); in uds_make_open_chapter()
82 uds_free_open_chapter(open_chapter); in uds_make_open_chapter()
86 *open_chapter_ptr = open_chapter; in uds_make_open_chapter()
90 void uds_reset_open_chapter(struct open_chapter_zone *open_chapter) in uds_reset_open_chapter() argument
92 open_chapter->size = 0; in uds_reset_open_chapter()
93 open_chapter->deletions = 0; in uds_reset_open_chapter()
95 memset(open_chapter->records, 0, records_size(open_chapter)); in uds_reset_open_chapter()
96 memset(open_chapter->slots, 0, slots_size(open_chapter->slot_count)); in uds_reset_open_chapter()
99 static unsigned int probe_chapter_slots(struct open_chapter_zone *open_chapter, in probe_chapter_slots() argument
103 unsigned int slot_count = open_chapter->slot_count; in probe_chapter_slots()
109 record_number = open_chapter->slots[slot].record_number; in probe_chapter_slots()
122 record = &open_chapter->records[record_number]; in probe_chapter_slots()
124 !open_chapter->slots[record_number].deleted) in probe_chapter_slots()
135 void uds_search_open_chapter(struct open_chapter_zone *open_chapter, in uds_search_open_chapter() argument
142 slot = probe_chapter_slots(open_chapter, name); in uds_search_open_chapter()
143 record_number = open_chapter->slots[slot].record_number; in uds_search_open_chapter()
148 *metadata = open_chapter->records[record_number].data; in uds_search_open_chapter()
153 int uds_put_open_chapter(struct open_chapter_zone *open_chapter, in uds_put_open_chapter() argument
161 if (open_chapter->size >= open_chapter->capacity) in uds_put_open_chapter()
164 slot = probe_chapter_slots(open_chapter, name); in uds_put_open_chapter()
165 record_number = open_chapter->slots[slot].record_number; in uds_put_open_chapter()
168 record_number = ++open_chapter->size; in uds_put_open_chapter()
169 open_chapter->slots[slot].record_number = record_number; in uds_put_open_chapter()
172 record = &open_chapter->records[record_number]; in uds_put_open_chapter()
176 return open_chapter->capacity - open_chapter->size; in uds_put_open_chapter()
179 void uds_remove_from_open_chapter(struct open_chapter_zone *open_chapter, in uds_remove_from_open_chapter() argument
185 slot = probe_chapter_slots(open_chapter, name); in uds_remove_from_open_chapter()
186 record_number = open_chapter->slots[slot].record_number; in uds_remove_from_open_chapter()
189 open_chapter->slots[record_number].deleted = true; in uds_remove_from_open_chapter()
190 open_chapter->deletions += 1; in uds_remove_from_open_chapter()
194 void uds_free_open_chapter(struct open_chapter_zone *open_chapter) in uds_free_open_chapter() argument
196 if (open_chapter != NULL) { in uds_free_open_chapter()
197 vdo_free(open_chapter->records); in uds_free_open_chapter()
198 vdo_free(open_chapter); in uds_free_open_chapter()
238 struct open_chapter_zone *open_chapter; in fill_delta_chapter_index() local
243 open_chapter = chapter_zones[records % zone_count]; in fill_delta_chapter_index()
246 if (record_index > open_chapter->size || in fill_delta_chapter_index()
247 open_chapter->slots[record_index].deleted) { in fill_delta_chapter_index()
252 *record = open_chapter->records[record_index]; in fill_delta_chapter_index()
295 struct open_chapter_zone *open_chapter; in uds_save_open_chapter() local
313 open_chapter = index->zones[z]->open_chapter; in uds_save_open_chapter()
314 record_count += open_chapter->size - open_chapter->deletions; in uds_save_open_chapter()
326 open_chapter = index->zones[z]->open_chapter; in uds_save_open_chapter()
327 if (record_index > open_chapter->size) in uds_save_open_chapter()
330 if (open_chapter->slots[record_index].deleted) in uds_save_open_chapter()
333 record = &open_chapter->records[record_index]; in uds_save_open_chapter()
391 struct open_chapter_zone *open_chapter; in load_version20() local
394 open_chapter = index->zones[zone]->open_chapter; in load_version20()
395 remaining = uds_put_open_chapter(open_chapter, &record.name, in load_version20()