Skip to content

Commit

Permalink
optimize: added a tail pointer in mntinfo_add_list
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushT369 committed Feb 7, 2025
1 parent 44f9acb commit bf8c2e8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions criu/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,22 @@ static void mntinfo_add_list(struct mount_info *new)
{
if (!mntinfo) {
mntinfo = new;
mntinfo->tail = new->tail;
}
else {
mntinfo->tail->next = new;
mntinfo->tail = new->tail;
mntinfo->tail = new->tail;
} else {
mntinfo->tail->next = new;
mntinfo->tail = new->tail;
}
}

struct mount_info *tail_buffer;

void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new)
{
if(!*head)
tail_buffer = new;
if (!*head) {
tail_buffer = new;
}

new->next = *head;
new->next = *head;
new->tail = tail_buffer;
*head = new;
}
Expand Down Expand Up @@ -1202,7 +1202,7 @@ int __check_mountpoint_fd(struct mount_info *pm, int mnt_fd, bool parse_mountinf
return 0;

pr_warn("The file system %#x %#x (%#x) %s %s is inaccessible\n", pm->s_dev, pm->s_dev_rt, dev,
pm->fstype->name, pm->ns_mountpoint);
pm->fstype->name, pm->ns_mountpoint);
return -1;
}

Expand Down Expand Up @@ -1959,7 +1959,7 @@ static int dump_mnt_ns(struct ns_id *ns, struct mount_info *pms)
_mi = list_entry(_mi->children._el, struct mount_info, siblings); \
continue; \
} \
up: \
up: \
if (_fn_r(_mi)) \
return -1; \
if (_mi == _r) \
Expand Down

0 comments on commit bf8c2e8

Please sign in to comment.