Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp712947rdb; Fri, 26 Jan 2024 08:27:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOqfKzyFGZvjiFfVfXbBvaPqvoRaJz/NyOhpzpNviNmK7h9UTQxDcWYa1G7MvJMV/1OYx5 X-Received: by 2002:aa7:d64c:0:b0:559:9588:1bd4 with SMTP id v12-20020aa7d64c000000b0055995881bd4mr964127edr.25.1706286431014; Fri, 26 Jan 2024 08:27:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706286431; cv=pass; d=google.com; s=arc-20160816; b=B8kquRIEyZQo+D83Nud+t+KlylNOMcJ6Ski3h8DySfe4oW/ylXHXh1bx1du1RrIQ0A PNl5JbxLU79uXilrD7eV9fbOL1bGRv+v60OKvm9u0cqI7xq/w7v2gqoTHLYEYUqocFHK KUYXTBlX4UKUbkSLeEzQvFnjKy0XummiECBjh30WkFsatvhPlwLwOoYX7Y+lSO82fdEI Rcg+S3bYsTGIglGf+M0hqajWjk2dBBFPukzqsG1c9OO2HmoRc0rS4g94yJfVT7FFcrkU UE2A0MFtqPjMt5+AbKQS24HaUZjeQ6HB0mG7+w4ZO4kEduQ7VH0TiVIdzi+WQh/yF1ND gIlg== 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:references:in-reply-to:message-id :subject:cc:to:from:date; bh=R3/afPT6OCGMJ9FqGXbgG1nvfkYm+nYnyUZOVY955Oc=; fh=++he/LCGnAwK+JL35XBgdZdX4ofyyxRVjMcjWJViepw=; b=rHsvKD/nil0Z6a847+hB3eq5uH/HJYerXTGdjsICo+X6GRE+xjsr7d+09xVKdCzLe4 Sbxdg98yjc7j5DFtYlDQz211oR59/aF7ngiCE/9h/jWpQ0Mom/C7wkGxAL1lCfzJUgdU V8p9Yr9ABNQjyN0D6In37C46nDgMmah6y9Y11DzkVtMBQpS3dkycqswoFQsZSs4pHGD0 VfxAi6jjgGsAxNkKptt6qdCiouC+B7kfT6B7mdlIMP0JPFfP8LUXdv6pjSFggrFOU8eZ i+vmCtEotpydGU8Q//r+F4OPD9nFGlOR7VsGep0nmXKy4INZZCnDgNdoxbPT33TCx+w6 WDtA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-40334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40334-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i38-20020a0564020f2600b005591fee9119si844333eda.474.2024.01.26.08.27.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 08:27:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-40334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40334-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 855931F25DFD for ; Fri, 26 Jan 2024 16:26:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E718F1EA95; Fri, 26 Jan 2024 16:25:50 +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 7047A1DDF2 for ; Fri, 26 Jan 2024 16:25:50 +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=1706286350; cv=none; b=jzOU4U0DQ3gVV4EJatwTgiLZXpkfYUvsLU2me1K4u7px49fkbwBH3KLv6c64ETYaurY7hGO++LmyOHEpIf4ScWHERKrFcLGWgUIganuHGDd5tNDZH2GnzbxGyLsY0l+Og/q7b+CT2x7Mf44hFEJkgyYreX7Q7T6JPvwCYL+92a0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706286350; c=relaxed/simple; bh=usYo1qWpfr98O2uM2CcTxhxgQ9wwoLK07IN3DcRfu0c=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lBQ1lR9mtoSnwM113MEIC029f9/ZgLlguXBWKJu9E+Sp/xfgqlzbRL0SvusCmTPf06L4L4y8JH4vIQM7H7C4qScPEdW8KBrFj8Pvi+4N8biecpkKTj5GaKbh+/HRvZY6tmq6j+KY6PU2dVhX7KtB5hDPGBnPKtptSP3wm1Wfa4Y= 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 B7748C433F1; Fri, 26 Jan 2024 16:25:48 +0000 (UTC) Date: Fri, 26 Jan 2024 11:25:51 -0500 From: Steven Rostedt To: Christian Brauner Cc: Geert Uytterhoeven , Linus Torvalds , Kees Cook , linux-kernel@vger.kernel.org, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Al Viro , Ajay Kaher Subject: Re: [for-linus][PATCH 1/3] eventfs: Have the inodes all for files and directories all be the same Message-ID: <20240126112551.6b8c0450@gandalf.local.home> In-Reply-To: <20240126-wirksam-wenngleich-cd9573d8cb28@brauner> References: <20240122114743.7e46b7cb@gandalf.local.home> <20240122144443.0f9cf5b9@gandalf.local.home> <20240125-deportation-sogenannten-2d57a7ce8f81@brauner> <20240125130731.3b0e2a42@gandalf.local.home> <20240125130821.0a1cd3a7@gandalf.local.home> <20240126-wirksam-wenngleich-cd9573d8cb28@brauner> 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 26 Jan 2024 11:11:39 +0100 Christian Brauner wrote: > The size would be one thing. The other is that tar requires unique inode > numbers for all files iirc (That's why we have this whole btrfs problem > - let's not get into this here - where inode numbers aren't unique and > are duplicated per subvolume.). Well, I guess that answers Linus's question about wondering if there's any user space program that actually cares what the inodes are for files. The answer is "yes" and the program is "tar". And because tar cares, I think I should fix it for tracefs even if it doesn't work because of size. But the size issue is a trivial fix if I just default it to 1 page. I currently use get_next_ino(), but I can use my own version of that, and because each directory has a fixed number of files, I could have it be: /* Copied from get_next_ino but adds allocation for multiple inodes */ #define LAST_INO_BATCH 1024 #define LAST_INO_MASK (~(LAST_INO_BATCH - 1)) static DEFINE_PER_CPU(unsigned int, last_ino); unsigned int tracefs_get_next_ino(int files) { unsigned int *p = &get_cpu_var(last_ino); unsigned int res = *p; #ifdef CONFIG_SMP /* Check if adding files+1 overflows */ if (unlikely(!res || (res & LAST_INO_MASK) != ((res + files + 1) & LAST_INO_MASK))) { static atomic_t shared_last_ino; int next = atomic_add_return(LAST_INO_BATCH, &shared_last_ino); res = next - LAST_INO_BATCH; } #endif res++; /* get_next_ino should not provide a 0 inode number */ if (unlikely(!res)) res++; *p = res + files; put_cpu_var(last_ino); return res; } This way the eventfs inode would tell tracefs_get_next_ino() how many inode numbers it needs for its files and then when it creates the file inode, it can use: inode->i_ino = ei->ino + idx; Where idx is the index into the d_children array of the directory's eventfs_inode. -- Steve