[CRIU] [PATCH 1/4] mount: don't add a separate entry for each enabled file systems
Pavel Emelyanov
xemul at virtuozzo.com
Fri Apr 22 06:47:09 PDT 2016
On 04/22/2016 08:58 AM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
>
> It isn't required and we will not have a limit for enabled file systems.
>
> Cc: Oleg Nesterov <oleg at redhat.com>
> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
> criu/include/mount.h | 1 +
> criu/mount.c | 37 ++++++++++++++++++++-----------------
> criu/proc_parse.c | 4 ++++
> 3 files changed, 25 insertions(+), 17 deletions(-)
>
> diff --git a/criu/include/mount.h b/criu/include/mount.h
> index b3bbdce..59e7f9a 100644
> --- a/criu/include/mount.h
> +++ b/criu/include/mount.h
> @@ -56,6 +56,7 @@ struct mount_info {
> struct fstype *fstype;
> char *source;
> char *options;
> + char *fsname;
> union {
> bool mounted;
> bool dumped;
> diff --git a/criu/mount.c b/criu/mount.c
> index b829ae5..f57b10c 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -1679,11 +1679,14 @@ static int always_fail(struct mount_info *pm)
> return -1;
> }
>
> -static struct fstype fstypes[32] = {
> +static struct fstype fstypes[] = {
> {
> .name = "unsupported",
> .code = FSTYPE__UNSUPPORTED,
> }, {
> + .name = "auto_cr",
> + .code = FSTYPE__AUTO,
> + }, {
> .name = "proc",
> .code = FSTYPE__PROC,
> }, {
> @@ -1825,21 +1828,12 @@ static struct fstype *__find_fstype_by_name(char *fst, bool force_auto)
> for (i = 1; i < ARRAY_SIZE(fstypes); i++) {
> struct fstype *fstype = fstypes + i;
>
> - if (!fstype->name) {
> - if (!force_auto && !fsname_is_auto(fst))
> - break;
> -
> - fstype->name = xstrdup(fst);
> - fstype->code = FSTYPE__AUTO;
> - return fstype;
> - }
> -
> if (!strcmp(fstype->name, fst))
> return fstype;
> }
>
> - if (i == ARRAY_SIZE(fstypes)) /* ensure we have a room for auto */
> - pr_err_once("fstypes[] overflow!\n");
> + if (force_auto || fsname_is_auto(fst))
The force_auto is always false after this patch.
> + return &fstypes[1];
>
> return &fstypes[0];
> }
The patch brings some mess. The mi->fstype is non NULL on dump and can
be NULL on restore. And on dump we check for me.fstype being AUTO to
pick mi's fstype, while on restore check for mi->fstype itself.
Can we have a helper static inline char *mi_fstype(struct mount_info *mi)
that would consolidate all this knowledge inside?
-- Pavel
More information about the CRIU
mailing list