diff options
| author | Matthew Dillon <dillon@FreeBSD.org> | 2001-12-09 23:40:02 +0000 |
|---|---|---|
| committer | Matthew Dillon <dillon@FreeBSD.org> | 2001-12-09 23:40:02 +0000 |
| commit | 173592263d73ae87fa9d63922b98f990bf064fd4 (patch) | |
| tree | f3f84b26521094c279e0a04f4d5a2cde0af6dbb2 /lib/libdisk/chunk.c | |
| parent | 408d219e0abe383e09542eff21416e13ab158b34 (diff) | |
Notes
Diffstat (limited to 'lib/libdisk/chunk.c')
| -rw-r--r-- | lib/libdisk/chunk.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c index 83c247ae96a3..b2e9d3d9860e 100644 --- a/lib/libdisk/chunk.c +++ b/lib/libdisk/chunk.c @@ -363,6 +363,7 @@ Delete_Chunk(struct disk *d, struct chunk *c) { struct chunk *c1=0, *c2, *c3; chunk_e type = c->type; + long offset = c->offset; if(type == whole) return 1; @@ -398,9 +399,19 @@ Delete_Chunk(struct disk *d, struct chunk *c) } return 1; scan: + /* + * Collapse multiple unused elements together, and attempt + * to extend the previous chunk into the freed chunk. + */ for(c2 = c1->part; c2; c2 = c2->next) { - if (c2->type != unused) - continue; + if (c2->type != unused) { + if (c2->offset + c2->size != offset || + (c2->flags & CHUNK_AUTO_SIZE) == 0 || + (c2->flags & CHUNK_NEWFS) == 0) { + continue; + } + /* else extend into free area */ + } if (!c2->next) continue; if (c2->next->type != unused) |
