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

Directly allocate buffer memory in a pvck scan instead of using a mempool.

There's a very high memory usage when calling _pv_analyse_mda_raw (e.g. while
executing pvck) that can end up with "out of memory".

_pv_analyse_mda_raw scans for metadata in the MDA, iteratively increasing the
size to scan with SECTOR_SIZE until we find a probable config section or we're
at the edge of the metadata area. However, when using a memory pool, we're also
iteratively chasing for bigger and bigger mempool chunk which can't be found
and so we're always allocating a new one, consuming more and more memory...

This patch just changes the mempool to direct memory allocation in this
problematic part of the code.
This commit is contained in:
Peter Rajnoha 2011-08-29 13:37:36 +00:00
parent 11bfaa1df8
commit d35188058b
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.89 - Version 2.02.89 -
================================== ==================================
Directly allocate buffer memory in a pvck scan instead of using a mempool.
Add configure --with-thin for (unimplemented) segtypes "thin" and "thin_pool". Add configure --with-thin for (unimplemented) segtypes "thin" and "thin_pool".
Fix raid shared lib segtype registration (2.02.87). Fix raid shared lib segtype registration (2.02.87).

View File

@ -226,7 +226,7 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
* "maybe_config_section" returning true when there's no valid * "maybe_config_section" returning true when there's no valid
* metadata in a sector (sectors with all nulls). * metadata in a sector (sectors with all nulls).
*/ */
if (!(buf = dm_pool_alloc(fmt->cmd->mem, size + size2))) if (!(buf = dm_malloc(size + size2)))
goto_out; goto_out;
if (!dev_read_circular(area->dev, offset, size, if (!dev_read_circular(area->dev, offset, size,
@ -261,14 +261,14 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
size += SECTOR_SIZE; size += SECTOR_SIZE;
} }
} }
dm_pool_free(fmt->cmd->mem, buf); dm_free(buf);
buf = NULL; buf = NULL;
} }
r = 1; r = 1;
out: out:
if (buf) if (buf)
dm_pool_free(fmt->cmd->mem, buf); dm_free(buf);
if (!dev_close(area->dev)) if (!dev_close(area->dev))
stack; stack;
return r; return r;