Lines Matching refs:allocator
29 struct base_fs_allocator *allocator, in fs_free_blocks_range() argument
32 ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map; in fs_free_blocks_range()
67 struct base_fs_allocator *allocator) in basefs_allocator_free() argument
71 struct ext2fs_hashmap *entries = allocator->entries; in basefs_allocator_free()
75 fs_free_blocks_range(fs, allocator, &e->blocks); in basefs_allocator_free()
80 fs_free_blocks_bitmap(fs, allocator->dedup_block_map); in basefs_allocator_free()
81 ext2fs_free_block_bitmap(allocator->exclusive_block_map); in basefs_allocator_free()
82 ext2fs_free_block_bitmap(allocator->dedup_block_map); in basefs_allocator_free()
83 free(allocator); in basefs_allocator_free()
103 struct base_fs_allocator *allocator, in fs_reserve_block() argument
106 ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map; in fs_reserve_block()
107 ext2fs_block_bitmap dedup_map = allocator->dedup_block_map; in fs_reserve_block()
133 struct base_fs_allocator *allocator, in fs_reserve_blocks_range() argument
147 if (fs_reserve_block(fs, allocator, block)) in fs_reserve_blocks_range()
166 struct base_fs_allocator *allocator, in fs_reserve_blocks() argument
175 struct ext2fs_hashmap *entries = allocator->entries; in fs_reserve_blocks()
187 fs_reserve_blocks_range(fs, allocator, &e->blocks, st.st_size); in fs_reserve_blocks()
196 struct base_fs_allocator *allocator; in base_fs_alloc_load() local
198 allocator = calloc(1, sizeof(*allocator)); in base_fs_alloc_load()
199 if (!allocator) { in base_fs_alloc_load()
208 allocator->cur_entry = NULL; in base_fs_alloc_load()
209 allocator->entries = basefs_parse(file, mountpoint); in base_fs_alloc_load()
210 if (!allocator->entries) { in base_fs_alloc_load()
215 &allocator->exclusive_block_map); in base_fs_alloc_load()
219 &allocator->dedup_block_map); in base_fs_alloc_load()
223 retval = fs_reserve_blocks(fs, allocator, src_dir); in base_fs_alloc_load()
229 fs->priv_data = allocator; in base_fs_alloc_load()
234 basefs_allocator_free(fs, allocator); in base_fs_alloc_load()
240 static errcode_t get_next_block(ext2_filsys fs, struct base_fs_allocator *allocator, in get_next_block() argument
244 ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map; in get_next_block()
245 ext2fs_block_bitmap dedup_map = allocator->dedup_block_map; in get_next_block()
283 static void skip_blocks(ext2_filsys fs, struct base_fs_allocator *allocator, in skip_blocks() argument
287 struct block_range_list *list = &allocator->cur_entry->blocks; in skip_blocks()
288 ext2fs_block_bitmap exclusive_map = allocator->exclusive_block_map; in skip_blocks()
290 while (list->head && allocator->next_lblk < ctx->lblk) { in skip_blocks()
298 allocator->next_lblk++; in skip_blocks()
306 struct base_fs_allocator *allocator = fs->priv_data; in basefs_block_allocator() local
307 struct basefs_entry *e = allocator->cur_entry; in basefs_block_allocator()
308 ext2fs_block_bitmap dedup_map = allocator->dedup_block_map; in basefs_block_allocator()
311 if (allocator->next_lblk < ctx->lblk) in basefs_block_allocator()
312 skip_blocks(fs, allocator, ctx); in basefs_block_allocator()
313 allocator->next_lblk = ctx->lblk + 1; in basefs_block_allocator()
315 if (!get_next_block(fs, allocator, &e->blocks, ret)) in basefs_block_allocator()
342 if (!get_next_block(fs, allocator, &e->blocks, ret)) in basefs_block_allocator()
360 struct base_fs_allocator *allocator = fs->priv_data; in base_fs_alloc_set_target() local
365 if (allocator) { in base_fs_alloc_set_target()
366 allocator->cur_entry = ext2fs_hashmap_lookup(allocator->entries, in base_fs_alloc_set_target()
369 allocator->next_lblk = 0; in base_fs_alloc_set_target()
380 struct base_fs_allocator *allocator = fs->priv_data; in base_fs_alloc_unset_target() local
382 if (!allocator || !allocator->cur_entry || mode != S_IFREG) in base_fs_alloc_unset_target()
385 fs_free_blocks_range(fs, allocator, &allocator->cur_entry->blocks); in base_fs_alloc_unset_target()
386 delete_block_ranges(&allocator->cur_entry->blocks); in base_fs_alloc_unset_target()