Lines Matching refs:bbl
55 struct backed_block* backed_block_iter_new(struct backed_block_list* bbl) { in backed_block_iter_new() argument
56 return bbl->data_blocks; in backed_block_iter_new()
119 void backed_block_list_destroy(struct backed_block_list* bbl) { in backed_block_list_destroy() argument
120 if (bbl->data_blocks) { in backed_block_list_destroy()
121 struct backed_block* bb = bbl->data_blocks; in backed_block_list_destroy()
129 free(bbl); in backed_block_list_destroy()
177 static int merge_bb(struct backed_block_list* bbl, struct backed_block* a, struct backed_block* b) { in merge_bb() argument
193 block_len = a->len / bbl->block_size; /* rounds down */ in merge_bb()
230 static int queue_bb(struct backed_block_list* bbl, struct backed_block* new_bb) { in queue_bb() argument
233 if (bbl->data_blocks == nullptr) { in queue_bb()
234 bbl->data_blocks = new_bb; in queue_bb()
238 if (bbl->data_blocks->block > new_bb->block) { in queue_bb()
239 new_bb->next = bbl->data_blocks; in queue_bb()
240 bbl->data_blocks = new_bb; in queue_bb()
247 if (bbl->last_used && new_bb->block > bbl->last_used->block) in queue_bb()
248 bb = bbl->last_used; in queue_bb()
250 bb = bbl->data_blocks; in queue_bb()
251 bbl->last_used = new_bb; in queue_bb()
263 merge_bb(bbl, new_bb, new_bb->next); in queue_bb()
264 if (!merge_bb(bbl, bb, new_bb)) { in queue_bb()
266 bbl->last_used = bb; in queue_bb()
273 int backed_block_add_fill(struct backed_block_list* bbl, unsigned int fill_val, unsigned int len, in backed_block_add_fill() argument
286 return queue_bb(bbl, bb); in backed_block_add_fill()
290 int backed_block_add_data(struct backed_block_list* bbl, void* data, unsigned int len, in backed_block_add_data() argument
303 return queue_bb(bbl, bb); in backed_block_add_data()
307 int backed_block_add_file(struct backed_block_list* bbl, const char* filename, int64_t offset, in backed_block_add_file() argument
321 return queue_bb(bbl, bb); in backed_block_add_file()
325 int backed_block_add_fd(struct backed_block_list* bbl, int fd, int64_t offset, unsigned int len, in backed_block_add_fd() argument
339 return queue_bb(bbl, bb); in backed_block_add_fd()
342 int backed_block_split(struct backed_block_list* bbl, struct backed_block* bb, in backed_block_split() argument
346 max_len = ALIGN_DOWN(max_len, bbl->block_size); in backed_block_split()
360 new_bb->block = bb->block + max_len / bbl->block_size; in backed_block_split()