Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp88526rdb; Sun, 28 Jan 2024 15:24:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmXHYsKrvfn4zQSsvWqbZ6IDQMurot3pXgV/aXezFaIBJuNuU1nEYMFQpPDV3FRE3K4wSL X-Received: by 2002:a05:6214:258d:b0:682:bfd2:f3d5 with SMTP id fq13-20020a056214258d00b00682bfd2f3d5mr6243748qvb.109.1706484282651; Sun, 28 Jan 2024 15:24:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706484282; cv=pass; d=google.com; s=arc-20160816; b=0f5+TYAo926BCGJPQTAh2gDaOhdXiZs+OsRVYxEhmkx30BsGGqnwVuc0vwrFUkCHO+ YyK3kulnDRiaSMiMGGNPdxeNDoanUUDjIm9uUFSVOYp8RB32i6tjmZAC8zkXU0dAz/GW gWyiR/LAwddHk/6dTkf2MiwmMUrKJYo+BanPhhbk1wOS42eud1x2tQ53KZW3+V479cJc b3C0CzNjxkUKcffdsryWzCCOPclxn+8TlQOELU8dNZatshldYMxF1vMhy5hXSxVhbUIV R+M+65cLO6Rk2DmAxEv5q7VdUnT0lm53sKERNQXwoBWlRZMCjK5RTiZ3Y+qP4Lnkc5dn Lbww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=8xYcjk2qCrA+lcOwLQA0ixbhMQnVA5kQAe6loZvmX60=; fh=25A28idcD68zldJo3uiBhZCATh1rJJJ6nSU/srkbZ6s=; b=mJw7+zMIzvtpqvAlbKq9YA8yd6z5/Pf1RCzy5fc8M8rrS8MaE8tR+jiux0xiRYgCk4 jD3AmZc6IKTefxKSCJ3y4VuDnu0TMBF16aj0wYRxZOKIK+7Mm/ssoOITIywFbCCAD9P3 KMC/zaQYR6UQm4boPZSvkTc3h0IMLXbxgg/kfTlZmougCLNvIhSuLkfpoTAxJ6EAUy5g vk/Q33PPuywhwe9MKCE6F3AdjhRU5/ypMM/TwSc76+zISA7o6ZJOQv4FnzMAbpigWpKF F2cFDzjg811RiDSF9qc6I9dBQ6BexKlvoR9vIqd0Temlj/gaLyPBGnSmg4qlo2x9dG7S GP4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=II43344E; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-42009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42009-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dv11-20020ad44eeb000000b00683a93c788dsi6602895qvb.380.2024.01.28.15.24.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 15:24:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=II43344E; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-42009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42009-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5C15A1C21F23 for ; Sun, 28 Jan 2024 23:24:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14EB245945; Sun, 28 Jan 2024 23:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="II43344E" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CF94446C7 for ; Sun, 28 Jan 2024 23:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706484272; cv=none; b=tTWXB8d+w0xklVqRZx1Yv+imlRnpNnFu5bS0AUhDKrQF4SFelzid1n2gxCqawZwexsKFhOMFaWxfz47RQ/RPWMhgK0RJCLX3m+MZ2ezH8XxPWB/w5RS8um3HIPXHIgmmoZGp1EjPs1kjCHA+Y41Ed3z2jzBV/SYM0C8gFz8I1oA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706484272; c=relaxed/simple; bh=9/r5pGc0syXMlG1sSpc6aC3inL799ywZ/tGalu+3l60=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=G4jypEkM9yeREd8TWmkKQHeWtKzbTZ7PmfLUOHqYz7bZNAxW4bv+0K+VBS9F+OiFjxkxXoZu0vvOxfep/hCLiVGQiQIbdb7gJ5G+9fSPHvWWKUdamtQoW5lZ8B7rTVG8Sa6tIxLr5LwjhjhL4M7EXuVi8qF5JD9RDM19F81/0pk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=II43344E; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d04fb2f36bso352791fa.2 for ; Sun, 28 Jan 2024 15:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1706484268; x=1707089068; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8xYcjk2qCrA+lcOwLQA0ixbhMQnVA5kQAe6loZvmX60=; b=II43344EzuRtLxWRYIYQ1ku2EyINcHsK3HSfV2nWQpeHJcA0w3GTuYug9tzJd6/5XH yxZn9cJkOKMRRtausXDKfEyRuGiQvnB9H9s5281jE1h1r3V/YfzBnu2j1CcL3z9s8lwp Pv6FUmB2pCp3Y3tF8huGtvE3LYdO6+uKWAwz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706484268; x=1707089068; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8xYcjk2qCrA+lcOwLQA0ixbhMQnVA5kQAe6loZvmX60=; b=k2ndEfpyFBuP4ZD14N/i1HUY4dJkThu5WUhjx+kfxtuaTZJJyz76yCsREQ3DRB4oX0 p0BvVKNxWcqQlrqPzW6Pbwl4ZqYtiV9geTISwQ68Z2rp0hOnYKcwoOYqqMPJy1GaDCQq KT4B/fuOUFG8rgB63T3KOeSw8JgkXS4dE9XiEJ4oUSNf5KLJc7VKTyB7ljBV0/xMOSrD /9IaPVUmy5TTrSwE1XkXW9euPTOC9Mi1MRX22Ql6EGdvRdhspf30n9F/eP/4FBcsKhMH Go+a+iWD03Wz90r3ST341xHMsnoVhNIhw9W2IJLlSy24kgMngGbOh/MOvgNc7X5US0ew R2YA== X-Gm-Message-State: AOJu0YyU8t+OiVwOdw+9u8c9fk6iee9IR7iKZfEpXEDKDh6HNlWBht9M OL4J+WT4IYXaq/896BnVRTigxq1MfiW2X02ZQj9OrVjo3Ci4Qk2xwGJgyWFqroAQLuEtiemK/SY ARjr3AQ== X-Received: by 2002:a2e:a36d:0:b0:2cf:2ef2:87f7 with SMTP id i13-20020a2ea36d000000b002cf2ef287f7mr2998031ljn.53.1706484268201; Sun, 28 Jan 2024 15:24:28 -0800 (PST) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id x7-20020a2e7c07000000b002cf2966f94csm947564ljc.43.2024.01.28.15.24.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Jan 2024 15:24:27 -0800 (PST) Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2cf1fd1cc5bso24643831fa.3 for ; Sun, 28 Jan 2024 15:24:27 -0800 (PST) X-Received: by 2002:a2e:a4bc:0:b0:2d0:4e84:b278 with SMTP id g28-20020a2ea4bc000000b002d04e84b278mr160192ljm.7.1706484266774; Sun, 28 Jan 2024 15:24:26 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240126150209.367ff402@gandalf.local.home> <20240126162626.31d90da9@gandalf.local.home> <20240128175111.69f8b973@rorschach.local.home> In-Reply-To: <20240128175111.69f8b973@rorschach.local.home> From: Linus Torvalds Date: Sun, 28 Jan 2024 15:24:09 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] eventfs: Have inodes have unique inode numbers To: Steven Rostedt Cc: Masami Hiramatsu , Mathieu Desnoyers , LKML , Linux Trace Devel , Christian Brauner , Ajay Kaher , Geert Uytterhoeven , linux-fsdevel Content-Type: text/plain; charset="UTF-8" On Sun, 28 Jan 2024 at 14:51, Steven Rostedt wrote: > > I was working on getting rid of ei->dentry, but then I hit: > > void eventfs_remove_dir(struct eventfs_inode *ei) > { [..] > > Where it deletes the all the existing dentries in a tree. Is this a > valid place to keep ei->dentry? No, when you remove the directory, just leave the child dentries alone. Remember: they are purely caches, and you either have - somebody is still using it (you can 'rmdir()' a directory that some other process has as its cwd, for example), which keeps it alive and active anyway - when the last user is done, the dcache code will just free the dentries anyway so there's no reason to remove any of the dentries by hand - and in fact simple_recursive_removal() never did that anyway for anything that was still busy. For a pure cached set of dentries (that have no users), doing the last "dput()" on a directory will free that directory dentry, but it will also automatically free all the unreachable children recursively. Sure, simple_recursive_removal() does other things (sets inode flags to S_DEAD, does fsnotify etc), but none of those should actually matter. I think that whole logic is simply left-over from when the dentries weren't a filesystem cache, but were the *actual* filesystem. So it actually became actively wrong when you started doing your own backing store, but it just didn't hurt (except for code legibility). Of course, eventfs is slightly odd and special in that this isn't a normal "rmdir()", so it can happen with files still populated. And those children will stick around and be useless baggage until they are shrunk under memory pressure. But I don't think it should *semantically* matter, exactly because they always could stay around anyway due to having users. There are some cacheability knobs like .d_delete = always_delete_dentry, which probably makes sense for any virtual filesystem (it limits caching of dentries with no more users - normally the dcache will happily keep caching dentries for the *next* user, but that may or may not make sense for virtual filesystems) So there is tuning that can be done, but in general, I think you should actively think of the dcache as just "it's just a cache, leave stale stuff alone" Linus