2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

17 Commits

Author SHA1 Message Date
Cyrill Gorcunov
a1fe3caf04 protobuf: Start switching our image entries to Google's protobuf
A short story -- there were a long conversation on which format should
be used to keep checkpointed data on disk image. We ended up in using
Google's Protocol Buffers (see https://developers.google.com/protocol-buffers/
for detailed description). Thus image entries should be convered to PB.

This patch converts fdinfo_entry to PB "message fdinfo_entry".

Build note: one should have protobuf and protobuf-c installed to be able
to build crtools.

 - http://code.google.com/p/protobuf/
 - http://code.google.com/p/protobuf-c/

Inspired-by: Pavel Emelianov <xemul@parallels.com>
Inspired-by: Kinsbursky Stanislav <skinsbursky@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:10:41 +04:00
Pavel Emelyanov
3386535491 kcmp: Introduce generic object ID generator
Just move the patched code from file-ids.c to kcmp-ids.c and
make the former one be client for the latter.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 18:01:18 +04:00
Pavel Emelyanov
51af25757d kcmp: Generalize tree showing code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 17:56:36 +04:00
Pavel Emelyanov
817b13fad2 kcmp: Make ID generation code return ID, not pointer on tree element
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 17:55:58 +04:00
Pavel Emelyanov
46aeebdb07 kcmp: Make ID generation tree work on abstract elements, not fd-entries
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 17:55:20 +04:00
Pavel Emelyanov
fe670c5a59 kcmp: Make IDs tree work on abstract kid_tree, not fd_id_ rb and Co
2nd step in making kid tree generic.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 17:54:35 +04:00
Pavel Emelyanov
14b04465a0 file-ids: Rename fd_id_ to kid_
kid_ stands for kernel id and this is preparation for making the fd_id_
tree generic enough to support any type of kcmp- calls.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 17:44:59 +04:00
Pavel Emelyanov
43367e2545 fdinfo: Rename fdinfo_entry addr to fd
Now we store only real fdtable entries in this file, so it's
time to name the field properly and change type to u32.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 16:18:33 +04:00
Pavel Emelyanov
447f369ba9 fd: Remove fs_is_special
It's no longer required. All the previously special fds are
now scattered over other images.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 15:54:28 +04:00
Pavel Emelyanov
69b3ebd002 vma: Remove FDINFO_MAP fd type
The regfile's ID of a VMA is stored in its shmid field. And the
file itself if sumped into regfiles.img image with 'special'-ly
generated ID (i.e. -- just allocate a new unique one).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-04-09 12:57:38 +04:00
Pavel Emelyanov
ea045dac61 file-ids: Report whether a new id was generated
This will be required to determine whether we should dump the respective
file, or it was already dumped and we just re-use its id in fdinfo_entry.

For special fd-s the ID is always new.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-25 21:04:34 +04:00
Pavel Emelyanov
c92c9e234e file-ids: Enlighten ID generation and storage
The unique id is 32 bit and consists only of the subid value. This
is _really_ enough. The genid part is just a hint for the tree-search
algirythm to avoid unneeded sys_kcmp calls.

Plus, generate IDs for special files. This will make it easier to
move the regfiles into into separate files (see the respective patch
for details).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-25 20:58:19 +04:00
Pavel Emelyanov
308f6150c2 file-ids: Fix collect genid type
It is u32 and that is it :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-24 17:00:06 +04:00
Pavel Emelyanov
ed67491c45 file-ids: Show collected subtree at the end of dump
Just for debugging. Useful to know how the tree was built

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-24 16:52:09 +04:00
Pavel Emelyanov
ab1c83b9a5 file-ids: Fix subnode linkage
The subtree node should be linked with common rbtree procedure. Otherwise
the very first subtree insertion results in an infinite loop in the rb
linking and balancing code.

Plus, mark the root as static and add the subroot node initialization check.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-24 16:51:00 +04:00
Stanislav Kinsbursky
12c5801749 dump: files tree - return id upon collect instead on inner structure
Hide the structure - it's not required.

[ xemul: Ranem long id into u32 id and adopt to current tree ]

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-03-24 00:40:52 +04:00
Cyrill Gorcunov
2acc741a3a files: Use sys_kcmp to find file descriptor duplicates v4
We switch generic-object-id concept with sys_kcmp approach,
which implies changes of image format a bit (and since it's
early time for project overall, we're allowed to).

In short -- previously every file descriptor had an ID
generated by a kernel and exported via procfs. If the
appropriate file descriptors were the same objects in
kernel memory -- the IDs did match up to bit. It allows
us to figure out which files were actually the identical
ones and should be restored in a special way.

Once sys_kcmp system call was merged into the kernel,
we've got a new opprotunity -- to use this syscall instead.
The syscall basically compares kernel objects and returns
ordered results suitable for objects sorting in a userspace.

For us it means -- we treat every file descriptor as a combination
of 'genid' and 'subid'. While 'genid' serves for fast comparison
between fds, the 'subid' is kind of a second key, which guarantees
uniqueness of genid+subid tuple over all file descritors found
in a process (or group of processes).

To be able to find and dump file descriptors in a single pass we
collect every fd into a global rbtree, where (!) each node might
become a root for a subtree as well.

The main tree carries only non-equal genid. If we find genid which
is already in tree, we need to make sure that it's either indeed
a duplicate or not. For this we use sys_kcmp syscall and if we
find that file descriptors are different -- we simply put new
fd into a subtree.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-02-28 19:13:47 +04:00