mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 22:35:33 +00:00
inotify: Use fast way of obtaining desired watch descriptor number
This patch makes restore_one_inotify() to request specific watch descriptor number instead of iterating in (possible) long-duration loop if system supports it. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
1cfb96956b
commit
c66ce3095f
@@ -35,6 +35,7 @@
|
|||||||
#include "files-reg.h"
|
#include "files-reg.h"
|
||||||
#include "file-ids.h"
|
#include "file-ids.h"
|
||||||
#include "criu-log.h"
|
#include "criu-log.h"
|
||||||
|
#include "kerndat.h"
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
#include "common/lock.h"
|
#include "common/lock.h"
|
||||||
#include "irmap.h"
|
#include "irmap.h"
|
||||||
@@ -569,11 +570,13 @@ static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info)
|
|||||||
iwe->mask, mask);
|
iwe->mask, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (kdat.has_inotify_setnextwd) {
|
||||||
* FIXME The kernel allocates wd-s sequentially,
|
if (ioctl(inotify_fd, INOTIFY_IOC_SETNEXTWD, iwe->wd)) {
|
||||||
* this is suboptimal, but the kernel doesn't
|
pr_perror("Can't set next inotify wd");
|
||||||
* provide and API for this yet :(
|
return -1;
|
||||||
*/
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int wd;
|
int wd;
|
||||||
|
|
||||||
@@ -589,6 +592,9 @@ static int restore_one_inotify(int inotify_fd, struct fsnotify_mark_info *info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kdat.has_inotify_setnextwd)
|
||||||
|
return -1;
|
||||||
|
|
||||||
inotify_rm_watch(inotify_fd, wd);
|
inotify_rm_watch(inotify_fd, wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user