Re: [PATCH v4 2/3] init/do_mounts.c: create second mount for initramfs

From: Christian Brauner
Date: Fri Jun 04 2021 - 05:59:17 EST


On Thu, Jun 03, 2021 at 11:05:08PM +0800, Menglong Dong wrote:
> On Thu, Jun 3, 2021 at 9:30 PM Christian Brauner
> <christian.brauner@xxxxxxxxxx> wrote:
> >
> [...]
> >
> > In fact you seem to be only using this struct you're introducing in this
> > single place which makes me think that it's not needed at all. So what's
> > preventing us from doing:
> >
> > > +
> > > + return do_mount_root(root->dev_name,
> > > + root->fs_name,
> > > + root_mountflags & ~MS_RDONLY,
> > > + root_mount_data);
> > > +}
> >
> > int __init prepare_mount_rootfs(void)
> > {
> > if (is_tmpfs_enabled())
> > return do_mount_root("tmpfs", "tmpfs",
> > root_mountflags & ~MS_RDONLY,
> > root_mount_data);
> >
> > return do_mount_root("ramfs", "ramfs",
> > root_mountflags & ~MS_RDONLY,
> > root_mount_data);
> > }
>
> It seems to make sense, but I just feel that it is a little hardcode.
> What if a new file system
> of rootfs arises? Am I too sensitive?

It'sn understandable but premature worry and I don't think it should
justify all that extra code.

Christian