Commit d092c5ae authored by Pavel Emelyanov's avatar Pavel Emelyanov

inotify: Optimize ify search when collecting wd for it

CRIU puts wd-s for one inotify in one row (one after another),
so when collecting next wd, we can find the ify to attach them
to faster.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent cb576d89
...@@ -420,10 +420,23 @@ static struct file_desc_ops fanotify_desc_ops = { ...@@ -420,10 +420,23 @@ static struct file_desc_ops fanotify_desc_ops = {
static struct fsnotify_file_info *find_inotify_info(unsigned id) static struct fsnotify_file_info *find_inotify_info(unsigned id)
{ {
struct fsnotify_file_info *p; struct fsnotify_file_info *p;
static struct fsnotify_file_info *last = NULL;
if (last && last->ife->id == id) {
/*
* An optimization for clean dump image -- criu puts
* wd-s for one inotify in one row, thus sometimes
* we can avoid scanning the inotify_info_head.
*/
pr_debug("\t\tlast ify for %u found\n", id);
return last;
}
list_for_each_entry(p, &inotify_info_head, list) list_for_each_entry(p, &inotify_info_head, list)
if (p->ife->id == id) if (p->ife->id == id) {
last = p;
return p; return p;
}
pr_err("Can't find inotify with id 0x%08x\n", id); pr_err("Can't find inotify with id 0x%08x\n", id);
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment