[linux-lvm] what is writed on raw disk,

Zdenek Kabelac zkabelac at redhat.com
Mon Sep 13 09:48:21 UTC 2010

Dne 10.9.2010 17:53, yue napsal(a):
> i want to know lvm2 on source-code level.
> and  kernel device-mapper??
> just analysis source code is hard, can you give me some function-call stream.
> and whole blueprint.

If you really want to know 'in-depth' detail - I may suggest to use tools like
kcachegrind to get flow-control.

It's in fact not so easy to describe lvm2 functionality in few lines and it's
also 'moving' target as some call flow changes over the time.

Very slight overview might look like this:

- read config
- scan available block devices according config (changes quite a lot with udev
integration and cache usage)
- create internal structures and do some action according to given command

- some of commands are changing dm table - so internal dm tree structure is
generated - this abstraction is hidden in libdm

- activation/deactivation is executed - note - as lvm2 supports clusters -
this is somewhat more complex and unless you plan to have a very deep look
inside  you probably don't want to know all the magic behind - lots of limits
apply - very tight memory rules needs to be preserved to avoid deadlocks...

If you plan to add new 'target' - you may look into lib/striped subdir - there
is very some simple example.

Some sort of 'virtual' methods calls are used - unfortunately this call flow
is far from complete so target usually needs few quirks here and there over
the whole code base for now and usually knows a long depth knowledge of this
process - far from perfect, but that's current status...


More information about the linux-lvm mailing list