Home | History | Annotate | Download | only in src

Lines Matching refs:reg

101 static void region_list_remove(struct region_list *list, struct region *reg)
103 if (reg->prev)
104 reg->prev->next = reg->next;
106 if (reg->next)
107 reg->next->prev = reg->prev;
109 if (list->first == reg)
110 list->first = reg->next;
112 if (list->last == reg)
113 list->last = reg->prev;
115 reg->next = NULL;
116 reg->prev = NULL;
119 static void region_list_append(struct region_list *list, struct region *reg)
122 list->first = reg;
123 list->last = reg;
124 list->iter = reg;
126 reg->prev = NULL;
128 list->last->next = reg;
129 reg->prev = list->last;
130 list->last = reg;
132 reg->next = NULL;
136 static void dump_starting_from(struct region *reg)
138 for (; reg; reg = reg->next) {
139 printf("%p: Blocks %d-%d (%d)\n", reg,
140 reg->bg * info.blocks_per_group + reg->block,
141 reg->bg * info.blocks_per_group + reg->block + reg->len - 1,
142 reg->len);
159 struct region *reg;
160 reg = malloc(sizeof(struct region));
161 reg->block = block;
162 reg->len = len;
163 reg->bg = bg_num;
164 reg->next = NULL;
166 region_list_append(&alloc->list, reg);
266 struct region *reg = alloc->list.last->prev;
269 if (reg) {
270 reg->next = NULL;
392 struct region *reg;
398 reg = malloc(sizeof(struct region));
399 reg->block = block;
400 reg->len = allocate_len;
401 reg->next = NULL;
402 reg->prev = NULL;
403 reg->bg = found_bg;
404 return reg;
416 struct region *reg;
419 reg = ext4_allocate_best_fit_partial(len);
420 if (reg == NULL)
424 first_reg = reg;
427 prev_reg->next = reg;
428 reg->prev = prev_reg;
431 prev_reg = reg;
432 len -= reg->len;
447 struct region *reg = ext4_allocate_best_fit(len);
449 if (reg == NULL)
453 alloc->list.first = reg;
454 alloc->list.last = reg;
464 struct region *reg = alloc->list.first;
466 for (i = 0; reg != NULL; reg = reg->next)
475 struct region *reg = alloc->list.first;
477 for (i = 0; reg != NULL; reg = reg->next)
478 i += reg->len;
486 struct region *reg = alloc->list.iter;
489 for (; reg; reg = reg->next) {
490 if (block < reg->len)
491 return reg->block + block;
492 block -= reg->len;
499 struct region *reg = alloc->oob_list.iter;
502 for (; reg; reg = reg->next) {
503 if (block < reg->len)
504 return reg->block + block;
505 block -= reg->len;
544 struct region *reg = alloc->list.iter;
548 while (reg && len >= reg->len) {
549 len -= reg->len;
550 reg = reg->next;
553 if (reg == NULL && len > 0)
559 new->bg = reg->bg;
560 new->block = reg->block + len;
561 new->len = reg->len - len;
562 new->next = reg->next;
563 new->prev = reg;
565 reg->next = new;
566 reg->len = len;
572 return reg;
611 struct region *reg = list->iter;
613 while (reg != NULL && blocks > 0) {
614 if (reg->len > list->partial_iter + blocks) {
619 blocks -= (reg->len - list->partial_iter);
621 reg = reg->next;
643 struct region *reg = ext4_allocate_best_fit(len);
645 if (reg == NULL) {
650 for (; reg; reg = reg->next)
651 region_list_append(&alloc->oob_list, reg);
763 struct region *reg;
765 reg = alloc->list.first;
766 while (reg) {
767 struct region *next = reg->next;
768 free(reg);
769 reg = next;
772 reg = alloc->oob_list.first;
773 while (reg) {
774 struct region *next = reg->next;
775 free(reg);
776 reg = next;