1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add some assertions to allocation code.

This commit is contained in:
Alasdair Kergon 2010-03-25 18:16:54 +00:00
parent 0aae84f9a2
commit a7ca334681
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.63 -
================================
Add some assertions to allocation code.
Introduce pv_area_used into allocation algorithm and add debug messages.
Add activation/monitoring to lvm.conf.
Add --monitor and --ignoremonitoring to lvcreate.

View File

@ -600,6 +600,11 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
if (segtype_is_virtual(segtype))
return ah;
if (!(area_count + log_area_count)) {
log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
return NULL;
}
if (!(ah->mem = dm_pool_create("allocation", 1024))) {
log_error("allocation pool creation failed");
return NULL;
@ -744,6 +749,11 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t needed,
uint32_t total_area_count = ah->area_count + (log_needs_allocating ? ah->log_area_count : 0);
struct alloced_area *aa;
if (!total_area_count) {
log_error(INTERNAL_ERROR "_alloc_parallel_area called without any allocation to do.");
return 1;
}
remaining = needed - *allocated;
area_len = remaining / ah->area_multiple;