From patchwork Sun Feb 4 01:16:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 196398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp148450dyb; Sat, 3 Feb 2024 17:23:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5zSnimSePTtMn1hiGkfZhjaZVw57kCkIApowk/R+m8iWdteZ0QquIPOoBh4LOiIoPH4Ke X-Received: by 2002:a17:902:ce8a:b0:1d9:93d2:5208 with SMTP id f10-20020a170902ce8a00b001d993d25208mr2803530plg.49.1707009830522; Sat, 03 Feb 2024 17:23:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707009830; cv=pass; d=google.com; s=arc-20160816; b=gXj/mk7ZU6tkXQVRHJJ3H6z64oobGKE/FI6COijtbY/0WuV8RTTuv+nIeg2S1j9jIh 05Pl/tbZmVvNhtqU68qebMih9E7wjL2psM+Z+6dXKxlpcIauYmO5svRZ7NS1iFDTJkf8 Lhiw81jh5NMWqv3Suh6XKwFvM63ddV3NXdUuELOZinzFZ55vH8CkbiEOw167919joHDR PXArm8XuxGPsX8YomS+bcCxSJ2SPcsvvM2LNgkNff+dADQ5Y7lfbGnBq6Dkup1smDtzT O6tRjI3Z/tdxxj7O6TYF2EMD9v8GByEYwp4T707KQf9kskOQGCztESaNXzQYoK4zq4D1 Zwbg== 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=sX2U4fn5nXNdqkLT1dHacTBbKDWCkf/VnF2DbXzJnzU=; b=BxVw5UOl5TTPtStzJqVpxgPGsHgk+xgVO3l3gCbwA/MktDdCoet8UYyXJrDFqHTdjV e2L2EdcbZogpiG3Rx4VGnDVjrvJDYhElfuE1ayBH81Q0mj5r53zms4pINxjZBWDJZbq8 hs97TKnDcwhDQln2sL4ESVrJvCE1n6BigvM9bXn0kPKzzvAoEpyecZQvAAKqQXb5mY/K Wib5eArmbqFwZRjuaOl2d7gt8khl2auGVI9qro0nDHz0bNgTxsvhh+dVINis/dIHqLKf POqZDut4SD3u7g+toQO561mwBAx8AS/AiRGAXnQdtZK+t87pFGlpWn4qXFPafmtoxuNs t6zQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-51343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51343-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWFy7yY1DPSww8Wtg0WE1vqKQteRK5lEGJYcfXMNsov73xyh0aEfmm7K/Sc1seDT3vzkxVP4KQEdZqWdoZ9L6QDkZquRA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j20-20020a170902f25400b001d94544ed1esi3925809plc.410.2024.02.03.17.23.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 17:23:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51343-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-51343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51343-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 85492B25BFF for ; Sun, 4 Feb 2024 01:21:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D503C13AF0; Sun, 4 Feb 2024 01:18:09 +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 C863915E5D4; Sun, 4 Feb 2024 01:18:05 +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=1707009485; cv=none; b=lqiNP3mVwEcNk4HwjCc9KMb8JlRpDWdgnVLt9qUqh3liyicAov5uZ4rHGkdt/UlUI+QjIHPfkwQMALElAkgc2qqEuVAosLeZzGc1mOC7CFOSc7Iq3SPF+SWhmaQ8TqReM1xfu9cmf6XmntULdFkOoCiEnySJCfncDE6f7W+KpYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707009485; c=relaxed/simple; bh=+l/2J1wuNvwwox8H/9diOMBy2Vp1lI/iE/4NnUV0Ybw=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=RCsmJ5UAXhOWayFjOG/76WbNyPadgsJwsvnIhrCP59RiB/lURfveoncOuZMDO7BYYz0PgDhJVikDpZyudCPS4G6nPvSdmH8CXKEnSHKxSwf+eJ/oBphWhIxVmGV7wjD2S9AmFbh3KmCLBC6Zazz/g6AM9Bkn2HrX3BHcjz2v1n0= 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 A9046C433C7; Sun, 4 Feb 2024 01:18:05 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rWR9Q-00000006OoL-1NNa; Sat, 03 Feb 2024 20:18:28 -0500 Message-ID: <20240204011828.189770756@goodmis.org> User-Agent: quilt/0.67 Date: Sat, 03 Feb 2024 20:16:23 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Christian Brauner , Al Viro , Ajay Kaher Subject: [v6.7][PATCH 08/23] eventfs: Have the inodes all for files and directories all be the same References: <20240204011615.703023949@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: 1789929540439830228 X-GMAIL-MSGID: 1789929540439830228 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;