From patchwork Tue Jan 16 21:12:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 188627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp556631dye; Tue, 16 Jan 2024 14:23:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHn4vKqT0rd389ARQbf+UE73C/JXCMOHvOrPVFdki8v0BV9ut3QmGncYHV9Qn3uXW9SZOXj X-Received: by 2002:a05:6214:5004:b0:681:1880:edb3 with SMTP id jo4-20020a056214500400b006811880edb3mr10872816qvb.86.1705443781080; Tue, 16 Jan 2024 14:23:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705443781; cv=pass; d=google.com; s=arc-20160816; b=CcX/L+cluHM5eN+nzMO1SU2C1WOsGao0uzpUOSIF3/KAvreopWQYH61PgjCNQbArSx b4ghTvNQU0w9tKng4YVdMT5DNrtqJdHW3iYAG0xFK/Ag1o2p4IZymwjnO9JwCYv4q9ZC vKp1ThWgxTuMZM/p5gPjq/+aDr+1ESWf2Z6S1uG2IrOhwPSe6gYqaGUUAy/KpzCc7B0Y nJd64Is8jDfiDxIOEBmlwJlhzdUsPe5QoNE/M2lH2YGU8d/P/c3j553+E+m/rgLmLQ3P 1BRGRP4ORENYBX7g9S0QjmlUHXGvLf2B4OKGekjty4yZV7GVpukMzR3ad2E5POyTRmZo 9llQ== 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=dngBknn4wP2qzJoE/V+RLnUT8RGvtsDGRViH53B85zQ=; fh=SHNjIQ5NiBLJI+0nRu+6GGNjttG4PRTXqMBzXW+Ekzs=; b=P3ItaI0l7mkueOnaTd015ObLgV/+x18dG1vViygZGY+k4jsiA6unZdC1btMhFbyajy Jnxk+6dgjvkvcl3b1jrWNvl6YR6lWriZ6sOFZfN86FAAUqXFeQ+USrJsWp/TSTRICYBH ekqR6v17Q7/GdSLAk0O57DiVTy9gUIer2nxqH5MpFA4WpkVwrG8h18TggZVfy0Xwlfff zzx04tat7/s9jKgMG6MPcAD5ZLgOnWS8XY3ARIzDkgFCt0SY44q3hweS7dF1Cl0IjnLd MbVfzOXMeI95ISHDpLZD9NoCBlHAqUd0xBWM7J0WNhy5vw2HMP33LwW47T0t+u0gjsI0 oDsA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-28284-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28284-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y5-20020a0cc545000000b0068061339977si10514017qvi.241.2024.01.16.14.23.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:23:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28284-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-28284-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28284-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D9F731C26F1A for ; Tue, 16 Jan 2024 22:23:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 559312D629; Tue, 16 Jan 2024 21:12:40 +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 9724D200B7; Tue, 16 Jan 2024 21:12:38 +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=1705439558; cv=none; b=X6ehvOFD8TKPa+EPPzMtRo7Dahrzi6cac58Fn5ZrxN1lqxy9zm674ebx3lBtW6yl8qUsJ1DBmN7V6cK583Y/sdglNYuZTDuM4oj/e7R7H2FjDBO50hqrsJEfl8V8yRtOE9y9dmu+2TqTldAtqP7A3w7ZhSdMcfdCjbhftDjY5ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705439558; c=relaxed/simple; bh=mSSEti/pws5tstaq4hJGZy7wJkxktJfMLR7SyPu5kN4=; h=Received:Received:Message-ID:User-Agent:Date:From:To:Cc:Subject: References:MIME-Version:Content-Type; b=ja7qFTeKCsLpAm2G+MEddfADK42XFCxAOLf7UHZzdqKs0Hq8MHvcNo1YBppuh0M0MZJQlcdmAjUClBpw/AUkOHQ5+L+It2WChGL/VkO4SYniesMGnj7q1B0MxC9PVlkxvj7WJFlKmhCtNBQDisK7IAmwI1pKQqpmtzZWmneGV+I= 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 3A57EC43390; Tue, 16 Jan 2024 21:12:38 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rPqkr-00000001PQy-2KDw; Tue, 16 Jan 2024 16:13:53 -0500 Message-ID: <20240116211353.412180363@goodmis.org> User-Agent: quilt/0.67 Date: Tue, 16 Jan 2024 16:12:18 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Linus Torvalds , Christian Brauner , Al Viro , Ajay Kaher , linux-fsdevel@vger.kernel.org Subject: [PATCH v2 1/2] eventfs: Have the inodes all for files and directories all be the same References: <20240116211217.968123837@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788287417876559789 X-GMAIL-MSGID: 1788287417876559789 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/ 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;