[CRIU] [PATCH 09/12] dump: files tree - move subid to main list node
Kinsbursky Stanislav
skinsbursky at openvz.org
Fri Mar 23 12:24:05 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Cleanup patch.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
file-ids.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
-------------- next part --------------
diff --git a/file-ids.c b/file-ids.c
index 0e69f39..3d5711d 100644
--- a/file-ids.c
+++ b/file-ids.c
@@ -76,9 +76,9 @@ struct fd_id_entry {
} __aligned(sizeof(long));
static struct rb_root dump_file_forest[FD_INFO_MAX];
-static unsigned long fd_id_entries_subid = 1;
-static struct fd_id_entry *alloc_fd_id_entry(u32 genid, pid_t pid, int fd, u8 *new_entry)
+static struct fd_id_entry *alloc_fd_id_entry(struct fd_id_entry *parent, u32 genid,
+ pid_t pid, int fd, u8 *new_entry)
{
struct fd_id_entry *e;
@@ -86,13 +86,16 @@ static struct fd_id_entry *alloc_fd_id_entry(u32 genid, pid_t pid, int fd, u8 *n
if (!e)
goto err;
- e->u.key.subid = fd_id_entries_subid++;
+ e->u.key.subid = 0;
e->u.key.genid = genid;
e->info.pid = pid;
e->info.fd = fd;
- /* Make sure no overflow here */
- BUG_ON(!e->u.key.subid);
+ if (parent) {
+ e->u.key.subid = ++parent->u.key.subid;
+ /* Make sure no overflow here */
+ BUG_ON(!parent->u.key.subid);
+ }
*new_entry = 1;
rb_init_node(&e->node);
@@ -125,7 +128,7 @@ lookup_alloc_subtree(struct fd_id_entry *e, u32 genid,
return this;
}
- sub = alloc_fd_id_entry(genid, pid, fd, new_entry);
+ sub = alloc_fd_id_entry(NULL, genid, pid, fd, new_entry);
if (!sub)
goto err;
@@ -160,7 +163,7 @@ static struct fd_id_entry *lookup_alloc_node(u8 type, u64 genid,
return lookup_alloc_subtree(this, genid, pid, fd, new_entry);
}
- e = alloc_fd_id_entry(genid, pid, fd, new_entry);
+ e = alloc_fd_id_entry(e, genid, pid, fd, new_entry);
if (!e)
goto err;
More information about the CRIU
mailing list