Lines Matching refs:bbl
55 struct backed_block *backed_block_iter_new(struct backed_block_list *bbl) in backed_block_iter_new() argument
57 return bbl->data_blocks; in backed_block_iter_new()
130 void backed_block_list_destroy(struct backed_block_list *bbl) in backed_block_list_destroy() argument
132 if (bbl->data_blocks) { in backed_block_list_destroy()
133 struct backed_block *bb = bbl->data_blocks; in backed_block_list_destroy()
141 free(bbl); in backed_block_list_destroy()
191 static int merge_bb(struct backed_block_list *bbl, in merge_bb() argument
209 block_len = a->len / bbl->block_size; /* rounds down */ in merge_bb()
247 static int queue_bb(struct backed_block_list *bbl, struct backed_block *new_bb) in queue_bb() argument
251 if (bbl->data_blocks == NULL) { in queue_bb()
252 bbl->data_blocks = new_bb; in queue_bb()
256 if (bbl->data_blocks->block > new_bb->block) { in queue_bb()
257 new_bb->next = bbl->data_blocks; in queue_bb()
258 bbl->data_blocks = new_bb; in queue_bb()
265 if (bbl->last_used && new_bb->block > bbl->last_used->block) in queue_bb()
266 bb = bbl->last_used; in queue_bb()
268 bb = bbl->data_blocks; in queue_bb()
269 bbl->last_used = new_bb; in queue_bb()
281 merge_bb(bbl, new_bb, new_bb->next); in queue_bb()
282 merge_bb(bbl, bb, new_bb); in queue_bb()
288 int backed_block_add_fill(struct backed_block_list *bbl, unsigned int fill_val, in backed_block_add_fill() argument
302 return queue_bb(bbl, bb); in backed_block_add_fill()
306 int backed_block_add_data(struct backed_block_list *bbl, void *data, in backed_block_add_data() argument
320 return queue_bb(bbl, bb); in backed_block_add_data()
324 int backed_block_add_file(struct backed_block_list *bbl, const char *filename, in backed_block_add_file() argument
339 return queue_bb(bbl, bb); in backed_block_add_file()
343 int backed_block_add_fd(struct backed_block_list *bbl, int fd, int64_t offset, in backed_block_add_fd() argument
358 return queue_bb(bbl, bb); in backed_block_add_fd()
361 int backed_block_split(struct backed_block_list *bbl, struct backed_block *bb, in backed_block_split() argument
366 max_len = ALIGN_DOWN(max_len, bbl->block_size); in backed_block_split()
380 new_bb->block = bb->block + max_len / bbl->block_size; in backed_block_split()