[v6.6,42/57] eventfs: Have the inodes all for files and directories all be the same
Message ID | 20240206120953.213007763@rostedt.homelinux.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-54919-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1501063dyb; Tue, 6 Feb 2024 04:26:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IErxWL59iDFJ36UmZC41mGquENr1dJluDgvviOgX/H8gvYrYuxiHz3WSvfTsOqAFl+ahs6G X-Received: by 2002:a05:6808:648b:b0:3bf:e5bb:a924 with SMTP id fh11-20020a056808648b00b003bfe5bba924mr1174298oib.22.1707222409853; Tue, 06 Feb 2024 04:26:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707222409; cv=pass; d=google.com; s=arc-20160816; b=xx5rRLS0HhfOt7cew3U9GDrYwbNOw9PvkNsz89Q8X1azsTpOS0CX/Hun/WTelGl4qF ptfXs9VkMDzNBYKiUFUcfl+zApxIFNLX74MtA3H6UFCq2aaWOJrFRYTII4T54hTzTJcV b4T0+EzrYF3ro7mJwICdhOaxeheisM8LytMQBUSIPb4ZMB+QUYhmjf8SS93tx2+9i2bS FYsLtg5ccy5x7/d0D1ComBL1ezyREvJd1xPlpttu20TkmJdFmyuMYHCgfyQY3lHsDpXS CPeg1Al8daipvQ5HbnaDcYJBze1sWLHsZHPPrto4kI/l+fOok6vel2R6NypYg5ZhdoO2 ZJZg== 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=NFwJnllDgkmKUCAFM0ZNhValf5u7fX7uufCXeGIC+9U=; b=YdHHhMCPxqn+i/C3tS5Xml98TqFWOIk76S+KC2jZqDdcEbELO1j58ASp+FkGm7QHFH vW9b8GVlMkFV0WGAVU3Vp0NCTocc35OcST5KKcm/a1V30ZbIKFzv+AwQNCHx5HU9xazJ Jh9vySZFWw0EEcHrHTtKCBdysgaPQYHiTBXppRpGR0rS0vwyEJcU7WZDBCp7iaCR+YAy M9wokE/DKgExt7kjlY8xEJun6GDcAbyh5XwL1r3WFNJ7Dxv9lV2WUS/AUvE1eg7Nma5c WMq3zPkhVo7pzy2+z27ethsLtQJjZX5wBnLZEttmBb3ih3B5ahbiajhwY0QZJGh6AjRj 6WGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54919-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54919-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXYV6E2MmaqzkfceQB0F/SIkl8fC7Xue08XBwfwDzXVJtQu7NcoJCuQe3O2wMUb+Vx/WCnZqlbGS/Np9YE56BOcj6qIgw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p12-20020a05622a00cc00b0042bf838e0dbsi2113088qtw.416.2024.02.06.04.26.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:26:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54919-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-54919-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54919-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 8762A1C243C3 for <ouuuleilei@gmail.com>; Tue, 6 Feb 2024 12:26:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14318150980; Tue, 6 Feb 2024 12:09: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 599A113AA4F; Tue, 6 Feb 2024 12:09:25 +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=1707221365; cv=none; b=BQo46NRutz+Zvau02aIT/QHezI/YRDfupUJ49e/q+l7YrawngmmXPW7RzpMx9av+u0M37Ft0vedD8Dm4S7S/onWJLzWN5IZ23sgCiDT4YV4JKazBLg1jKh7BKDmWj1OwpD3NhlURNfE+d0aXhwHsoIMYW6fcSxK/OghalqB6XjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221365; c=relaxed/simple; bh=JSygnlx6+56lX3XXzthIgsNjw4j5XL26vPR3L/z2tEs=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=q1daJ/dPzF6nKoLch3zSXSN0W3caS48pd9RLyWVsM6/1jl8XBjr5RTAKdvkjZ9DkYNLSXQiIDzA9SB7JVlpuJFHKld2ai9zcdylx7VYfsgj9DBJcJ+kHty6PiKsOO79BY/SfCTEZu89WzrzRDg9ZeVZ/KYbWPpNmg+avTjKAK2g= 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 E5AC5C43609; Tue, 6 Feb 2024 12:09:24 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from <rostedt@rostedt.homelinux.com>) id 1rXKGv-00000006bML-1VEK; Tue, 06 Feb 2024 07:09:53 -0500 Message-ID: <20240206120953.213007763@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:47 -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.6][PATCH 42/57] eventfs: Have the inodes all for files and directories all be the same References: <20240206120905.570408983@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: 1790152445991954131 X-GMAIL-MSGID: 1790152445991954131 |
Series |
eventfs: Linus's updates for 6.6
|
|
Commit Message
Steven Rostedt
Feb. 6, 2024, 12:09 p.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;