Skip to content

Commit 8215777

Browse files
mkayyashandroid-build-merger
authored and
android-build-merger
committed
Incr Ext4: Properly merge block_allocation lists
am: f7124d6 * commit 'f7124d6c955c0453361b0ff47c5c94619e68087f': Incr Ext4: Properly merge block_allocation lists Change-Id: I9d343f1762c183aaf4cacd9f7fd613af174896e3
2 parents 2592d45 + f7124d6 commit 8215777

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Diff for: ext4_utils/allocate.c

+14
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ void region_list_append(struct region_list *list, struct region *reg)
9797
reg->next = NULL;
9898
}
9999

100+
void region_list_merge(struct region_list *list1, struct region_list *list2)
101+
{
102+
if (list1->first == NULL) {
103+
list1->first = list2->first;
104+
list1->last = list2->last;
105+
list1->iter = list2->first;
106+
list1->partial_iter = 0;
107+
list1->first->prev = NULL;
108+
} else {
109+
list1->last->next = list2->first;
110+
list2->first->prev = list1->last;
111+
list1->last = list2->last;
112+
}
113+
}
100114
#if 0
101115
static void dump_starting_from(struct region *reg)
102116
{

Diff for: ext4_utils/allocate.h

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void append_region(struct block_allocation *alloc,
9494
struct block_allocation *create_allocation();
9595
int append_oob_allocation(struct block_allocation *alloc, u32 len);
9696
void region_list_append(struct region_list *list, struct region *reg);
97+
void region_list_merge(struct region_list *list1, struct region_list *list2);
9798
void print_blocks(FILE* f, struct block_allocation *alloc, char separator);
9899
void reserve_bg_chunk(int bg, u32 start_block, u32 size);
99100
int reserve_blocks_for_allocation(struct block_allocation *alloc);

Diff for: ext4_utils/extent.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static struct block_allocation *do_inode_allocate_extents(
9696
block_len + 1 - prealloc_block_len);
9797
return NULL;
9898
}
99-
region_list_append(&prealloc->list, alloc->list.first);
99+
region_list_merge(&prealloc->list, &alloc->list);
100100
free(alloc);
101101
}
102102
alloc = prealloc;

0 commit comments

Comments
 (0)