[v6.7,v2,08/23] eventfs: Have the inodes all for files and directories all be the same
Message ID | 20240206113359.393228331@rostedt.homelinux.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-54792-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1479861dyb; Tue, 6 Feb 2024 03:46:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5++dNCbdOOvz/o2jQiFnEqmIUWVg35OxadM2JMQg0TnlvyBZbd5LKGQpIzgOg2omSBB58 X-Received: by 2002:a9d:64d4:0:b0:6dd:e29d:dbf6 with SMTP id n20-20020a9d64d4000000b006dde29ddbf6mr1914956otl.16.1707220002995; Tue, 06 Feb 2024 03:46:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707220002; cv=pass; d=google.com; s=arc-20160816; b=B8ua0Yk5+La4aSyq7Xg3hS7UKvUDBhRq6Ed8Hh+KHF0v2sGL2l0CmpS/dLcVEhXONy 0sUv2tJzTdLsJbvKPE5CcJVkor7bXvUumURstEPXYRJBaWlGClZ7Aop9gzgM/QDzi2il NxYptQoQlnkk4F4beQlKFbAdVbjNSqmEhN4npQXurYWo4pg6z7uy4KaemAI5voZ6rZUU shvoesJv+J2NBh2b47l5tvS/myTeQzdG2oHqxPwrjO1KueV5j//Y9vllPSSdqTIrFe4l 70o20CQey8jadWlq4Gi2oWWpbxz3TCD35GHNSgrk9XWMGZkOn1AmO2daL32Q8qmqdDg6 VCKw== 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=td1cyB3gu4vQ5m1uxuZTAdd1+/C4/C4JbPlA6D7R5q4=; fh=XznEfJaYTlPakgPdqXirKeyyJrCljedkxrjjPMvkHt0=; b=JCICoRV/VFjkWQf9fEyQ1QbAGk+rTzR1eJcQp0zhFUFUFI/B3ynYaR1souAvxnfaY8 hsvaLBKQWnsLb2POtkpBTgfG0J4P8Yj/Ea70JN43E6p8wLRE8pCxuqVlfnbdhnwtXwYF i+8mXA3l3t1iskDFkOykjPExqNkRmzgtD/nEInycPf5dB6Rfe5tdriBSt8OF4czHLxwU kucH4B4YBJ1gURLxcexY5WjMzJBUE/d1mjIl0/gaJ+DMz4yUlHzeKJb5xEm7Wmp4IzsQ tTu1TJIHNZcGktOca4wTa4PJfErXLhbCsHu92J/RL41yjb7gwOmCjNZNGkzfg/0Rm2zr A5lQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54792-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54792-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUAGqc6hnqNYWikpRq/tCcWyUDXmJjnJd3+Fj/rExZ6W2PrPGnyPoliHKBr/UlV049pYc5zVJLPJ7UB7XLvguskH827Gg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i38-20020a635866000000b005d622b60818si1552944pgm.803.2024.02.06.03.46.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 03:46:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54792-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54792-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54792-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F374FB223E4 for <ouuuleilei@gmail.com>; Tue, 6 Feb 2024 11:46:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD99D135A45; Tue, 6 Feb 2024 11:33:34 +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 4B136133987; Tue, 6 Feb 2024 11:33:31 +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=1707219211; cv=none; b=PBJwj2CcHbU3Qsc2uLHuio2wxfLDKOR+bISjr4W6Rlgo9TFYRVjihSvNQPCO9wy/ZSEPPlGuAkTZuzsmaFkCu6AKvOjnqKosHhFZXfpFvBTgtTVFl7pnEkOfiHAqhH9IxQjAO7zva6kHUOaX3eaiZ4zcF4f3rgCR1igS6bocz1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707219211; c=relaxed/simple; bh=JSygnlx6+56lX3XXzthIgsNjw4j5XL26vPR3L/z2tEs=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=aNHJpennxOWhSmaLTPRnq8Jd5WX9qI7JzeT/ryWz5eDLa7h9pLVmzERqmx6kY8LKI0DYF0BrbvzojNd1VImkrhKE6G/gxVYIcHoWH7wJuGRKbtqm0ycDNBlmQa8NM+ERVCzzWx+Hq26FyUAotuibgIGnxb7TJN4M73Gay3Jdxm0= 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 1EEF0C43330; Tue, 6 Feb 2024 11:33:31 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from <rostedt@rostedt.homelinux.com>) id 1rXJiB-00000006aKJ-2Ejb; Tue, 06 Feb 2024 06:33:59 -0500 Message-ID: <20240206113359.393228331@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 06:32:06 -0500 From: Steven Rostedt <rostedt@goodmis.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>, Masami Hiramatsu <mhiramat@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Christian Brauner <brauner@kernel.org>, Al Viro <viro@ZenIV.linux.org.uk>, Ajay Kaher <ajay.kaher@broadcom.com> Subject: [v6.7][PATCH v2 08/23] eventfs: Have the inodes all for files and directories all be the same References: <20240206113158.822006147@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790149921747454755 X-GMAIL-MSGID: 1790149921747454755 |
Series |
eventfs: Linus's updates for 6.7
|
|
Commit Message
Steven Rostedt
Feb. 6, 2024, 11:32 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> 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 <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Ajay Kaher <ajay.kaher@broadcom.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> (cherry picked from commit 53c41052ba3121761e6f62a813961164532a214f) --- 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;