proc-parse: Parse pid's fdinfo entries

The existing code opens "self" and parses what's in there,
just twist the code a little to accept generic pid.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pre-dump: Collect mount info, root and nsmask

Well, we want to pre-dump files (fsnotifies), for that we
will need mountinfo-s and root, and for the latter -- the
current ns mask.

The problem with current ns mask is that its generation is
incorporated into ns IDs generation and dumping. And since
the ids dumping is not performed on pre-dump, let's just
provide a helper for ns-mask generation.

Strictly speaking, the whole ns-mask idea is not great, but
it's to be fixed later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Pre-dump file descriptors

We will generate some info about file-descriptors at that
stage. For now these pre-dumped ones would be fsnotifies,
so the pre-dump of a single fd is written as simple as
possible, but enough for that type of FDs pre-dump.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
img: Needed declarations for irmap-cache image file

The irmap-cache is PB-file (like the stat-* ones).
See commtns in next patches for more details.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
irmap: Revalidate irmap entries if required

We will load some irmap entries in cache from image file,
thus producing potentially stale data in irmap cache. To
handle this, make it possible to mark the entries with
need-revalidation mark and do fstat + numbers comparison
when meeting the entry in cache.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
irmap: Introduce irmap on-disk cache

When dumping fsnotifies we may go to irmap to get inode->path
mapping. The irmap engine scans FS (in hinted locations) to
get one and it is slow even though we scan only part of the FS.

Since the above scanning is done while tasks are frozen the
freeze time goes up :(

Improve the situation by generating irmap cache in working dir
at pre-dump when tasks get unfrozen.

The on-disk irmap cache is PB file, it sits in -W directory
and can be loaded on dump/pre-dump start in memory. When
resolving the inode->path mapping irmap may meet these entries,
revalidate them and potentially save time.

After pre-dump the (re-)collected irmap data is written back
to irmap cache image. Typically entries written back are the
same read in on cache load.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
stats: Add irmap resolve time

It's useful to know this value.

W/o cache (first pre-dump) on minimal container the irmap
resolve time is ~0.2 sec. With cache (next pre-dumps or
final dump) on the same container the irmap resolve time
is 10 times less.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
irmap: Try to load irmap cache from parent as well

If we make workdir coincide with images dir, the irmap
cache will be put in parent images for subsequent dump-s.
Try to load it from there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>