Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3778722pxj; Mon, 24 May 2021 14:51:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/gkkyt2fzfnmhal044B2HC6T8ofytQ8p3c23yUw25+LjNVMMwuaVS9Ko2SfnN9H89K6xU X-Received: by 2002:a5e:930d:: with SMTP id k13mr17510398iom.61.1621893084913; Mon, 24 May 2021 14:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621893084; cv=none; d=google.com; s=arc-20160816; b=LdsSMQt82bstv1Vx9+OtsEPyE0KbBRQ/zOXpn6F6uwQKSphzxq06OORG3BDmbkZGbK E/pwS73uQAV3qY9VfG5anMnG99MfohP742ngRB7mqE0EJLFfXzdXI8nsSrGvF/GexWxe Mm84V6itCdj3DwxEqqs73emrtP+2JYadGr9f4ZbwLE5haAaVsSGVnHVZVfJ0k0h/m0Kf MPXetht43LG75B/GURK2fytdsubt4l71wblEutThFbLu4+qktgxWTUumw6MsCsYgaKes ZlaZqoqLK+cEVZwNQ6HQLX+45U5F72CGqB4L4W9NEDIo0zMZGlp7BDd8jCvUQZR6aRmM GVpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ZrqHjXQRC4M7qVgUSaWTrcOaZ1f9fw7G33qll6nxKv8=; b=GRmSWluUjKmyFonhCD8YXw6QZBS0qMkjQcPZOKky3sVHZtRUfpmHzyr32qzihQOo5J sa1f/4xUYYyy4TtIx0WFMkXfD9ov2cp9z3bbCC96r5vjVNQRfi1J7NmG/nc1HhGcCbgn hkdaV+2AMVCwIo4e0Jlo3Mka8mZd3g9Lf1oJzwqzOvAwh3tFLE7GjyY1onZug4rcg0Er Xdq6CEgBPqPfYI1NpD6Y4izsDNvbBHNomN091mGz9uv/S9yeXvyfjgp0XJG69N777x5E hUQb0HbVvtNZyqkC0sAokxdR9pG/Aqa/wtNF/yiyJYGUE+UvGtAPuTD0SGwrfgB7OtWQ 6OpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si14571996ilg.130.2021.05.24.14.51.11; Mon, 24 May 2021 14:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233778AbhEXVtY (ORCPT + 99 others); Mon, 24 May 2021 17:49:24 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:38460 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233353AbhEXVtX (ORCPT ); Mon, 24 May 2021 17:49:23 -0400 Received: by mail-pj1-f41.google.com with SMTP id cu11-20020a17090afa8bb029015d5d5d2175so12028701pjb.3; Mon, 24 May 2021 14:47:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZrqHjXQRC4M7qVgUSaWTrcOaZ1f9fw7G33qll6nxKv8=; b=ThCRpB1vTjEbTL6AMIbSYUGrXyCho/AQAUdJgiZkzRyEvMIwjk2Ck/kkx/+3J0d8CZ 3UqyasmRqAU4ZCRLvKeaQDjmgR03PY3toc6yk/8fp16hrmrmMm/mDor6Zdv0l6o9JNr3 7yZY6WIaySv3w/vkgTmQT5haUWTSuvFREnBaknHtrMpbytCgrS4HxnYjf75H07AI1vO0 TkdI/n8lU7PedkukKuE/epfojRaONpsB55suIm+R64tMvqVPwWzM1AeI1W0abNYLLxhH beqIZoIZFjtkHueup0DkMcNA+wkespjWHlyS8a2ooT/qSPrZDbj5Ek8nN3KdgnRLPZVp jniQ== X-Gm-Message-State: AOAM533ZA6TNiwYIUI1BYx84My1ptsH3fnq4qvGf3NhVC5pgL3n9qTmx +sjyQ2uE4U2tzbaakQoDltM= X-Received: by 2002:a17:90a:8a07:: with SMTP id w7mr26982435pjn.192.1621892873290; Mon, 24 May 2021 14:47:53 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id m1sm8545842pgd.78.2021.05.24.14.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 14:47:52 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 95210401AD; Mon, 24 May 2021 21:47:51 +0000 (UTC) Date: Mon, 24 May 2021 21:47:51 +0000 From: Luis Chamberlain To: menglong8.dong@gmail.com Cc: viro@zeniv.linux.org.uk, keescook@chromium.org, samitolvanen@google.com, johan@kernel.org, ojeda@kernel.org, jeyu@kernel.org, joe@perches.com, dong.menglong@zte.com.cn, masahiroy@kernel.org, jack@suse.cz, axboe@kernel.dk, hare@suse.de, gregkh@linuxfoundation.org, tj@kernel.org, song@kernel.org, neilb@suse.de, akpm@linux-foundation.org, brho@google.com, f.fainelli@gmail.com, wangkefeng.wang@huawei.com, arnd@arndb.de, linux@rasmusvillemoes.dk, mhiramat@kernel.org, rostedt@goodmis.org, vbabka@suse.cz, glider@google.com, pmladek@suse.com, ebiederm@xmission.com, jojing64@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] init/do_mounts.c: fix rootfs_fs_type with ramfs Message-ID: <20210524214751.GZ4332@42.do-not-panic.com> References: <20210522113155.244796-1-dong.menglong@zte.com.cn> <20210522113155.244796-4-dong.menglong@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210522113155.244796-4-dong.menglong@zte.com.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 22, 2021 at 07:31:55PM +0800, menglong8.dong@gmail.com wrote: > From: Menglong Dong > > As for the existence of 'user root' which is introduced in previous > patch, 'rootfs_fs_type', which is used as the root of mount tree, > is not used directly any more. So it make no sense to switch it > between ramfs and tmpfs, just fix it with ramfs to simplify the > code. > diff --git a/init/do_mounts.c b/init/do_mounts.c > index 943cb58846fb..6d1253f75bb0 100644 > --- a/init/do_mounts.c > +++ b/init/do_mounts.c > @@ -689,24 +689,8 @@ void __init init_user_rootfs(void) > } > } > > -static bool is_tmpfs; > -static int rootfs_init_fs_context(struct fs_context *fc) > -{ > - if (IS_ENABLED(CONFIG_TMPFS) && is_tmpfs) > - return shmem_init_fs_context(fc); > - > - return ramfs_init_fs_context(fc); > -} > - > struct file_system_type rootfs_fs_type = { Then why not also just rename rootfs_fs_type to ram_rootfs_fs_type to make this even clearer now? > .name = "rootfs", > - .init_fs_context = rootfs_init_fs_context, > + .init_fs_context = ramfs_init_fs_context, > .kill_sb = kill_litter_super, > }; Luis