Lines Matching refs:len

40 	u32 len;
116 reg->bg * info.blocks_per_group + reg->block + reg->len - 1,
117 reg->len);
132 u32 block, u32 len, int bg_num)
137 reg->len = len;
244 /* Reduces an existing allocation by len blocks by return the last blocks
247 void reduce_allocation(struct block_allocation *alloc, u32 len)
249 while (len) {
252 if (last_reg->len > len) {
253 free_blocks(&aux_info.bgs[last_reg->bg], len);
254 last_reg->len -= len;
255 len = 0;
258 free_blocks(&aux_info.bgs[last_reg->bg], last_reg->len);
259 len -= last_reg->len;
332 static u32 ext4_allocate_blocks_from_block_group(u32 len, int bg_num)
334 if (get_free_blocks(bg_num) < len)
339 if (reserve_blocks(bg, bg->first_free_block, len) < 0) {
340 error("failed to reserve %u blocks in block group %u\n", len, bg_num);
344 aux_info.bgs[bg_num].data_blocks_used += len;
349 static struct region *ext4_allocate_contiguous_blocks(u32 len)
355 u32 block = ext4_allocate_blocks_from_block_group(len, i);
360 reg->len = len;
385 static struct region *ext4_allocate_partial(u32 len)
395 if (len <= bg_len) {
399 bg_len = len;
400 reg = ext4_allocate_contiguous_blocks(len);
411 reg->len = bg_len;
423 static struct region *ext4_allocate_multiple_contiguous_blocks(u32 len)
429 while (len > 0) {
430 reg = ext4_allocate_partial(len);
443 len -= reg->len;
449 struct region *do_allocate(u32 len)
451 struct region *reg = ext4_allocate_contiguous_blocks(len);
454 reg = ext4_allocate_multiple_contiguous_blocks(len);
459 /* Allocate len blocks. The blocks may be spread across multiple block groups,
462 1. Try to allocate the entire block len in each block group
467 struct block_allocation *allocate_blocks(u32 len)
469 struct region *reg = do_allocate(len);
500 i += reg->len;
512 if (block < reg->len)
514 block -= reg->len;
525 if (block < reg->len)
527 block -= reg->len;
534 void get_region(struct block_allocation *alloc, u32 *block, u32 *len)
537 *len = alloc->list.iter->len - alloc->list.partial_iter;
564 static struct region *do_split_allocation(struct block_allocation *alloc, u32 len)
570 while (reg && len >= reg->len) {
571 len -= reg->len;
575 if (reg == NULL && len > 0)
578 if (len > 0) {
582 new->block = reg->block + len;
583 new->len = reg->len - len;
588 reg->len = len;
601 static struct region *split_allocation(struct block_allocation *alloc, u32 len)
606 /* Then split off len blocks */
607 struct region *middle = do_split_allocation(alloc, len);
636 if (reg->len > list->partial_iter + blocks) {
641 blocks -= (reg->len - list->partial_iter);
663 int append_oob_allocation(struct block_allocation *alloc, u32 len)
665 struct region *reg = do_allocate(len);
668 error("failed to allocate %d blocks", len);
690 /* Mark the first len inodes in a block group as used */