Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp435451rdb; Wed, 17 Jan 2024 06:37:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4hnhtEWTZ+YAs0XnJPje7kub9US9yO9nGT9AhzngQrOKxTUBjl6M8DzDa7kktNnR0QHQ3 X-Received: by 2002:a05:6512:3711:b0:50e:262d:4834 with SMTP id z17-20020a056512371100b0050e262d4834mr3721432lfr.135.1705502229041; Wed, 17 Jan 2024 06:37:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705502229; cv=pass; d=google.com; s=arc-20160816; b=F+hnlRWJCmrQDlfbUOPdueLcLPu5vOhSU9/HOX9KTPyBoAXRo5HIjErivjqzL37ByA tNSRg2M0B3c/9TEVCw6HcCA0hNd7eJGFQA825cgrSAYgrMVQXF+OgQ9g4jk2xsbFeQD2 fWB0ZWsPWieu/iu3cfBp4qbVQ8IaeuRLZHzGULZTmrC1/JlfxtWK6toXsCp5dml7/m55 nkhTJfNxej2+SLMnpUJRWTgGVxKobOIExXW9WC62cxO5TVHFbtUz6MNZpFldMzduJeBN nMk0MYd3E9Z/RWt0NZgOSKhpj+thirMm8O6Ij6XpGyrZkb7CABX67NpBS2VWBLrSrUFD 36yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=I1A9XLc5OJzUlzQ1jciqsKfoXBmPjrac43W3isgcF3c=; fh=Onpp8nv7sOQgdX5WIAYpdraNIVCq2xlr/LuOORw6Jp0=; b=Krs4hU99wh/7zAdgulTbVyw+QCSTSldOhn1uNNlALEg6wEN2ZQ50tiA0g6uyFCmjUJ G3Nrv/Kq540HKn2/c/Ry0bmDO5rvsHUm6Yr9cc1jj+R2PcrKxWNiUsdxjIbgZsIaiZ6I HQ7vdAy+IlZ3c2H5ueWHqbN7ZrLBLmkYq2vrGU7eZ/85IOG8STGFvlSWs/luljaTh8yc mgvJj7tceM5+OW0cDCRObFz3sdK3peOIsUGhfokSqiiJa2iHreLpQcyjmCZOY7AnpC5M rPSloe2xgxOL9jBG89dghhB5gm4p3m8V2D471GxBTPjNB6RVmv83XO5817qRu+GTMUCp WUlg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-29085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29085-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v3-20020a170906564300b00a2a36d0ec74si5770393ejr.604.2024.01.17.06.37.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:37:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-29085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29085-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 997791F25E40 for ; Wed, 17 Jan 2024 14:37:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7892E20B37; Wed, 17 Jan 2024 14:36:54 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03CDD20334 for ; Wed, 17 Jan 2024 14:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705502214; cv=none; b=FCnPZXKvLa1KoPAoXkBtdcYlScU5QXRZVMoXJxf85jg9OOM5u34Vdsvkhua1cG/+R0AtIuhV0CrIPZjGDheVBUAmBbB6oZVvUqFV+lOVgfdgg4hs4v7K2RNbQIbUE9tBK7obXKaegC0v+EHUWG4EbyVNc7d7L8svzEfo/YspCoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705502214; c=relaxed/simple; bh=+l/2J1wuNvwwox8H/9diOMBy2Vp1lI/iE/4NnUV0Ybw=; h=Received:Received:Message-ID:User-Agent:Date:From:To:Cc:Subject: References:MIME-Version:Content-Type; b=FZNMTsUO2lvJrMLYd/9JDY4wuxXJ9/MB8Yfkb217f+wgowVEs/9Q4YMgoA4HKRXR3PnXU8g+/Bg5+m53nx4R3WC1/LgK3LoDJ71FZM/5A3id7/czR6lf+WgRrSWNxjeidDqWxT3yMsy0lCpOip8KsPlVNsxyXQzb89usGYjlxk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9275BC43399; Wed, 17 Jan 2024 14:36:53 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rQ73S-00000001XY4-2pb8; Wed, 17 Jan 2024 09:38:10 -0500 Message-ID: <20240117143810.531966508@goodmis.org> User-Agent: quilt/0.67 Date: Wed, 17 Jan 2024 09:35:49 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Christian Brauner , Al Viro , Ajay Kaher , Linus Torvalds Subject: [for-linus][PATCH 1/3] eventfs: Have the inodes all for files and directories all be the same References: <20240117143548.595884070@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: "Steven Rostedt (Google)" The dentries and inodes are created in the readdir for the sole purpose of getting a consistent inode number. Linus stated that is unnecessary, and that all inodes can have the same inode number. For a virtual file system they are pretty meaningless. Instead use a single unique inode number for all files and one for all directories. Link: https://lore.kernel.org/all/20240116133753.2808d45e@gandalf.local.home/ Link: https://lore.kernel.org/linux-trace-kernel/20240116211353.412180363@goodmis.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Christian Brauner Cc: Al Viro Cc: Ajay Kaher Suggested-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index fdff53d5a1f8..5edf0b96758b 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -32,6 +32,10 @@ */ static DEFINE_MUTEX(eventfs_mutex); +/* Choose something "unique" ;-) */ +#define EVENTFS_FILE_INODE_INO 0x12c4e37 +#define EVENTFS_DIR_INODE_INO 0x134b2f5 + /* * The eventfs_inode (ei) itself is protected by SRCU. It is released from * its parent's list and will have is_freed set (under eventfs_mutex). @@ -352,6 +356,9 @@ static struct dentry *create_file(const char *name, umode_t mode, inode->i_fop = fop; inode->i_private = data; + /* All files will have the same inode number */ + inode->i_ino = EVENTFS_FILE_INODE_INO; + ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE; d_instantiate(dentry, inode); @@ -388,6 +395,9 @@ static struct dentry *create_dir(struct eventfs_inode *ei, struct dentry *parent inode->i_op = &eventfs_root_dir_inode_operations; inode->i_fop = &eventfs_file_operations; + /* All directories will have the same inode number */ + inode->i_ino = EVENTFS_DIR_INODE_INO; + ti = get_tracefs(inode); ti->flags |= TRACEFS_EVENT_INODE; -- 2.43.0