From patchwork Wed Jan 31 19:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 194917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2125840dyb; Wed, 31 Jan 2024 11:51:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJDug0I7nR148LsSlcNjRFNJEX/nv1rLZxZPyOSAM4L1nD2Bmu4juCusJv/07uCluZyJSb X-Received: by 2002:a17:90b:46d4:b0:295:c639:8888 with SMTP id jx20-20020a17090b46d400b00295c6398888mr2685888pjb.13.1706730677603; Wed, 31 Jan 2024 11:51:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706730677; cv=pass; d=google.com; s=arc-20160816; b=kKzoqBvcDWUqno9xhLhVn0ecxMYEi1JdDzHFTWYrf3Ck87B29q1N4BwtV3crunOCzZ s/UufIlrj+dqLSSXT0cYg19li+lV35FyY2hx9hC57husYQxcYU0DAhYXQWj5ijEqC2mA D6oH8uzfeMWbQjSbMu2fv9NaWp7oIqLJWrLYdFfDbcQONqobP09yG+r6aMOYGSdSfha+ xeoXLPX4kiBm7434lKZY6eQaz6IGmk4gt+CBB0+ygc4zr2qJVtTHqCarZdghJIwcdrqG yodaokdGiBCvWLvLPolhgrxQZcTSO0yFyASV1/Czwczf0Jt3W7c8wzjayEuY+vOaGukQ 094A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date; bh=r1AjHpb7da+oGw+2Z68jCTp0V/lN6euFNaOvml/Xpjg=; fh=nq4nQbZu3UXWOofK71m6BI1cq7e35SbqCF2xSK9oMRU=; b=HDjLqsJW3LR1WqRGEK14Wks1L0rGehG+jYjNuvIsqaDSrNrOnIHfYnq1fE3uQGM+qW wzqnUh5Rt+VmHvO6tQ0Xx9bbtqkKZqzQiQWwYtL6c83HKZXBaFJTC0Oj73Vs1xqsBzMS Q2+mEfEc8+N7lRX7qJSLPycEcf/cuZ+8uEO0nYCbcXo/r4MRIiLGNucM4fC1/G9/m/MU 1Dtlltna5hpQmJElN96rbUH2RMLECbNBBo+UeroLTBy2N4JJulv7vi1LrS4lpAHOok3+ SwHMjzt5q9ApcRXGyR0b4aPavtcLx1natThtKZvDCuamKKzKOg17Jk2OkbKkihunPVO/ bjjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-47033-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47033-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVf6n2zUjSE0LNaoofnFsO+hyq26R/OuzOiLPXGE/l16lkEPGeAKfolLDqn0F+swhn48g++1DVQSHKY5T9VgqM+UG8M1g== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gw23-20020a17090b0a5700b00295f1aea266si1372453pjb.89.2024.01.31.11.51.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 11:51:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47033-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-47033-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47033-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5F1FE28BFE9 for ; Wed, 31 Jan 2024 19:51:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A2B23F8FB; Wed, 31 Jan 2024 19:51:03 +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 A39913EA7B; Wed, 31 Jan 2024 19:51:01 +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=1706730661; cv=none; b=u4z7zznMkwqDGKSky+EyicaRO0kEaXKZitMoT6SDuB02O4Ba/jya7x/LRZWS6o2ZEW+L7rU4Uhlfv2FntIiKy+E8Qw4rVeIgL2xpmBVjsw/Ugy3qUTAK61fYZd7zNZJDEHvpULrjscOWVbpTPk8AgnTVJ+LUWmkVXFm7aRR6anI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706730661; c=relaxed/simple; bh=WkxLzqe7R8IsUNodKo0seAmQQD7yja62YP4YaBbLLec=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=MgaxMt8ICsQU4S19oJlRU3VRp7cHaTJ94trVZEfzrNyNCDYsviwr7iiZgrS47mVyyZnKGMzSnEVEmgS7EgWd9vFODGsSSO4aUoO4Kae3GUDCU4o907mwHjuNtrSkNOswnZTDSIGPZDfe3WkDY/163r+YiqaZBD3h5dQPBuT8+pE= 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 752AEC433F1; Wed, 31 Jan 2024 19:51:00 +0000 (UTC) Date: Wed, 31 Jan 2024 14:51:14 -0500 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Linus Torvalds , Masami Hiramatsu , Mathieu Desnoyers Subject: [PATCH] eventfs: Restructure eventfs_inode structure to be more condensed Message-ID: <20240131145114.525936cc@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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: 1789636826884519360 X-GMAIL-MSGID: 1789636826884519360 From: "Steven Rostedt (Google)" Some of the eventfs_inode structure has holes in it. Rework the structure to be a bit more condensed, and also remove the no longer used llist field. Link: https://lore.kernel.org/linux-trace-kernel/CAHk-=wgh0otaSyV0MNrQpwFDTjT3=TWV94Wit2eUuPdh2KdyVg@mail.gmail.com/ Suggested-by: Linus Torvalds Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/internal.h | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h index 1886f1826cd8..beb3dcd0e434 100644 --- a/fs/tracefs/internal.h +++ b/fs/tracefs/internal.h @@ -32,40 +32,37 @@ struct eventfs_attr { /* * struct eventfs_inode - hold the properties of the eventfs directories. * @list: link list into the parent directory + * @rcu: Union with @list for freeing + * @children: link list into the child eventfs_inode * @entries: the array of entries representing the files in the directory * @name: the name of the directory to create - * @children: link list into the child eventfs_inode * @events_dir: the dentry of the events directory * @entry_attrs: Saved mode and ownership of the @d_children - * @attr: Saved mode and ownership of eventfs_inode itself * @data: The private data to pass to the callbacks + * @attr: Saved mode and ownership of eventfs_inode itself * @is_freed: Flag set if the eventfs is on its way to be freed * Note if is_freed is set, then dentry is corrupted. + * @is_events: Flag set for only the top level "events" directory * @nr_entries: The number of items in @entries + * @ino: The saved inode number */ struct eventfs_inode { - struct kref kref; - struct list_head list; + union { + struct list_head list; + struct rcu_head rcu; + }; + struct list_head children; const struct eventfs_entry *entries; const char *name; - struct list_head children; struct dentry *events_dir; struct eventfs_attr *entry_attrs; - struct eventfs_attr attr; void *data; + struct eventfs_attr attr; + struct kref kref; unsigned int is_freed:1; unsigned int is_events:1; unsigned int nr_entries:30; unsigned int ino; - /* - * Union - used for deletion - * @llist: for calling dput() if needed after RCU - * @rcu: eventfs_inode to delete in RCU - */ - union { - struct llist_node llist; - struct rcu_head rcu; - }; }; static inline struct tracefs_inode *get_tracefs(const struct inode *inode)