From nobody Tue Mar 07 14:11:57 2023 X-Original-To: freebsd-fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PWHSy6cg5z3wCHy for ; Tue, 7 Mar 2023 14:12:18 +0000 (UTC) (envelope-from woodsb02@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PWHSy64Wsz42Hp; Tue, 7 Mar 2023 14:12:18 +0000 (UTC) (envelope-from woodsb02@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678198338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Yil2Kz6xEDgxo1MWCuL0fUi2lPFBSNQuqV5PYt3OtY=; b=PDSAEMMERXBKPcby/uF5BotkH18DnzRTEpVfaWvlQKR6FDW/3YtrFqEB9KxToh3UAq+g+a Th1bU/XSpgtuxsdcoHvBbt1FH5j6lG12FmSmn1oED+dxTWeWe36JNzWX3QRJ5AYAaDXlBg N23NHojaha/+Ri0kl2ilHiiOnSe67A9UjxVvFIWlwIR32vRjwrSWKE80AmX5LhVI+cwIOa ZcKHVFx3J5EaxmsvCIaHUvwV+wjybRamzujcH90iDoUXwCjaFvCQnBZ8KTCNi70Qtuj77H UEGxJQkjXbVGodQ99/5liYu+ks05PebS7DZrwNRIBc/OC2CpzN+OUsU3AvXDSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678198338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Yil2Kz6xEDgxo1MWCuL0fUi2lPFBSNQuqV5PYt3OtY=; b=WBRjp/To+EC4JSTeRsN8rbZIM6GkoltEmdoa6nBKN3uUm8kfvc7SDoJ7jMyxub6nHfwxeV GHCX7O61MoXuhybR5wiSvgBjVbQG05+j3pil7hIK5u85Np1KkUwkIiAtsnoaPL0ybR3rlR 4bUwD0c9hgsY+08f2hci1C4lyO2zLS/hB+Mppvy11kBSVJxroHR+Pp9suYVP3S3wf4iPQP ZE3Te5Gu4ygK1PQPv1bmz/iTT6JklVVrOlMACont05voH5z7ydfPFjNJiHhmVsEFYZXHfW l8WTp8JPE/xBoULBBshBsx7O/O/70wu9gFKxyirx+8S4TQeRCa8KQ7SQp5sz0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678198338; a=rsa-sha256; cv=none; b=UW9c/+5Pm+yKMTGahiqt7zxJEE7jfyqvFZ7Btyw+akZNJmbDSvYauV+L6h1K6q8bGSpmWK 3eKeMWXzN3uZgE2Z73kFGT/80s8TrwCkL0S2msmyHVIWqHgOWPWFQcvG5MjQYPXDb7uo4l efUTgf5PYXfTpR5/nft/e2Q4K8iJWydJTcvgHX1GaehZD/tW/mE8z2YdXz0qWL5kaTkBc7 OCb314IEToVIMRk5NLIS41rP+ZVM7vGv6/mm6YhEG4YQnhw+mZZV/aiuM6xXnrQmJPCMGH BN2N0P8MnVVjdxnt01WGKq1XqOEXYXYzrvYUuQHfxZ4t6kfyZSz3peGtwJveNA== Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: woodsb02) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PWHSy541TzYgj; Tue, 7 Mar 2023 14:12:18 +0000 (UTC) (envelope-from woodsb02@freebsd.org) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 4648127C0054; Tue, 7 Mar 2023 09:12:17 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute1.internal (MEProxy); Tue, 07 Mar 2023 09:12:17 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddutddgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepfdeu vghnucghohhoughsfdcuoeifohhoughssgdtvdesfhhrvggvsghsugdrohhrgheqnecugg ftrfgrthhtvghrnhepledvveejfedvheeugffhfeeifeekjefhieffffdthfetgfffvddv feetgfevvefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepsggvnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidquddtleefieei vdekkedqvdegjeekvddvkedtqdifohhoughssgdtvdeppehfrhgvvggsshgurdhorhhgse ifohhoughsrdgrmh X-ME-Proxy: Feedback-ID: if9c9472a:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 17F552A20080; Tue, 7 Mar 2023 09:12:16 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-206-g57c8fdedf8-fm-20230227.001-g57c8fded List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org Mime-Version: 1.0 Message-Id: <53c6042f-bac1-479e-b1bd-5af5226d0f35@app.fastmail.com> In-Reply-To: <4a04386f-c58a-45d5-aabd-042d984f27b8@app.fastmail.com> References: <504ffe37-524a-4218-82e6-93459ef4b528@app.fastmail.com> <09df4665-b43d-9b07-cd4c-def3fd5fdffd@FreeBSD.org> <73441506-5147-4098-abc7-524c9f2791d1@app.fastmail.com> <5ecd7461-7dc7-5fa4-04fc-c76329a072f5@FreeBSD.org> <4a04386f-c58a-45d5-aabd-042d984f27b8@app.fastmail.com> Date: Tue, 07 Mar 2023 22:11:57 +0800 From: "Ben Woods" To: "Stefan Esser" Cc: "freebsd-fs@freebsd.org" Subject: Re: FAT32 statfs(2) inode usage Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On Tue, 7 Mar 2023, at 6:20 PM, Ben Woods wrote: > On Tue, 7 Mar 2023, at 6:11 PM, Stefan Esser wrote: >> >> I could implement a counter that provides a useful value for f_ffree = by >> counting all file and directory creations and removals from the root >> directory of a FAT12/FAT16 file system. > > If I=E2=80=99m right, the file system could easily be mounted outside = of=20 > FreeBSD on another machine that doesn=E2=80=99t maintain the counter. = For=20 > example, a USB stick shared between machines. Trying to infer state=20 > from past events is always hard. Instead, how hard would it be to have=20 > the kernel count the current number of root directory entries at the=20 > time the statfs request is issued (live)? I've noticed the following code is used for enforcing the limit of root = directory entities when creating a file or directory on a FAT filesystem= . Could msdosfs_statfs use something similar to determine the current co= unt of root directory entities? Source file: sys/fs/msdosfs/msdosfs_vnops.c Functions: msdosfs_create() and msdosfs_mkdir() ---------- /* * If this is the root directory and there is no space left we * can't do anything. This is because the root directory can not * change size. */ if (pdep->de_StartCluster =3D=3D MSDOSFSROOT && pdep->de_fndoffset >=3D pdep->de_FileSize) { error =3D ENOSPC; goto bad; } ---------- --=20 From: Ben Woods woodsb02@freebsd.org