Skip to content

Commit

Permalink
mnt: Optimize mntinfo_add_list to O(1) using a tail pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushT369 committed Feb 19, 2025
1 parent acd5e0a commit 1bc90f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions criu/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,16 @@ static void mntinfo_add_list(struct mount_info *new)

void mntinfo_add_list_before(struct mount_info **head, struct mount_info *new)
{
<<<<<<< HEAD
if (!*head)
tailbuffer = new;

INIT_LIST_HEAD(&new->tail);
list_add_tail(&tailbuffer->tail, &new->tail);
=======
if (!*head)
tail_buffer = new;
>>>>>>> 679741f33 (optimize: added a tail pointer in mntinfo_add_list)

new->next = *head;
*head = new;
Expand Down Expand Up @@ -1204,7 +1209,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 @@ -1961,7 +1966,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 1bc90f8

Please sign in to comment.