Skip to content

Change lvm2app memory allocation for pv/vg/lv properties

Dave Wysochanski lvm-devel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Use vg->vgmem to allocate vg/lv/pv string properties instead of dm_malloc/free.liblvm/lvm2app.h liblvm/lvm_lv.c liblvm/lvm_pv.c +1 more+20 -330 replies
2/2Change lvm2app version number from 1 to 2.VERSION+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Change lvm2app memory allocation for pv/vg/lv properties

This patchset changes memory allocation for pv/vg/lv properties in lvm2app. Unfortunately, this is a change to the existing API, but has the following benefits:
1) gives us consistency in memory handling across the API (lvm2app allocs/frees memory for strings and lists).
2) allows for simpler application code

A few downsides of this approach:
1) an application that repeatedly calls a 'get' property function will generate repeated allocations and could eventually trigger an OOM, as the only way to release memory is to release the vg handle. Possible fixes to this situation include the application release and reacquire the vg handle, or lvm2app provide another API to release object property memory tied to a vg handle (internally this would require a separate memory pool for the attribute memory). In any case, there are workarounds possible for this downside.
2) An application may hold a vg handle open longer than it would previously. This would mean an application would hold a lock longer than it might have had lvm2app given the application control of the memory. This is really an application issue though, since the application can simply copy memory properties it might need and release the vg handle.