From patchwork Fri Aug 23 17:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13775612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55689C52D7C for ; Fri, 23 Aug 2024 17:33:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B08BB800B6; Fri, 23 Aug 2024 13:33:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB86E800B4; Fri, 23 Aug 2024 13:33:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A6E8800B6; Fri, 23 Aug 2024 13:33:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7E2B9800B4 for ; Fri, 23 Aug 2024 13:33:55 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ED3B712123F for ; Fri, 23 Aug 2024 17:33:54 +0000 (UTC) X-FDA: 82484207988.16.FA5B95A Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf11.hostedemail.com (Postfix) with ESMTP id 63E3D40005 for ; Fri, 23 Aug 2024 17:33:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=Xrty0Hnc; dmarc=none; spf=pass (imf11.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724434416; a=rsa-sha256; cv=none; b=TQxpvvNG+ojADOvAZfDwxLe/rcCO/uVzBrhCk14hZmDKlUeJt+ngjEIZC0Lbma/kI5UpSg dTEpfB3OMm5q5C6M72JFdP7kzKYxLvQgVcQrqYbJ/2qNkiagbtMqDZgISk5ZvohBuLzMy0 WrxaKEdoJORJSBYFUXab4B75qCc5Kkw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=Xrty0Hnc; dmarc=none; spf=pass (imf11.hostedemail.com: domain of andrealmeid@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=andrealmeid@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724434416; h=from:from:sender: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: references:dkim-signature; bh=SxyIC5tFq6AtUq6R3df3UAsAHokn3gBbCFeE0EbVRo8=; b=t72J77PsK1EU5So46ZwP/CJGT2m51ymhKIlJXORbqWedHbiKTxMwWqPogBMUOwFpiu+Rxq JYJMVUwCLTqViITs6xL8wR5jYAWBfEGwsYFa/gcW1NraTTQ32g7mAuulIbWVBZrZrvcojS PLMEqJ3k0QnRe/K1nQ+0Rv51F1xT7Nc= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=SxyIC5tFq6AtUq6R3df3UAsAHokn3gBbCFeE0EbVRo8=; b=Xrty0Hnc0QheTY7+MW9JDReDc1 lgyN0AvuKVbjlkbjEtNp0FHvW4At/7wR2mkF/aShDa0OJpQjpAqK7xv4cTtSb1qtoOHGrov2C1vmg NNbLrVQtqHzd2CCGTtmzNInAOiTDeHuPWcNteHD96t83+XbRdQ9R1NNtm6LWBjCrKVyNJq4FIHtjb GSjk/uE7JMGiCbsGbDIqu+wvDSn4AeC5/IYp2tvuYYnsOyZg0dj7UES9hYOW9wWna5FnbTXHswPab g65joXcwN4RvGEPse9A7GGv6FMU2ZucgMVt/f9m7ejBAMTj0yQcQ8Hk1n9dSQfPjsmxjsq2BPn7wW 5LnIAJXQ==; Received: from [179.118.186.198] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1shYAM-0048Ww-1V; Fri, 23 Aug 2024 19:33:37 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Hugh Dickins , Andrew Morton , Alexander Viro , Christian Brauner , Jan Kara Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, krisman@kernel.org, Daniel Rosenberg , smcv@collabora.com, =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Almeida?= Subject: [PATCH 0/5] tmpfs: Add case-insesitive support for tmpfs Date: Fri, 23 Aug 2024 14:33:27 -0300 Message-ID: <20240823173332.281211-1-andrealmeid@igalia.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 63E3D40005 X-Rspamd-Server: rspam01 X-Stat-Signature: buieob8kuqae96nwj9u8m4r8ni6jz9ni X-HE-Tag: 1724434433-948885 X-HE-Meta: U2FsdGVkX19VaG/MK67OzP5l9eJndkMiOzJOeIdA2UsEDMn8WtiXBSKubPYelRNa218JV9L07taVfYh52qknWYO/T9juT5yzOabu1/gB2+nvqGR7kTS8vn6qy1iVv4bpLsPPa4+lKWYwE2rffvwnm0trJVA8xkGhNUA19XqujGcayu7A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hg7mjxns2IpJmuBOm0OivEpCsu0Qw6CYJkKkxqRT5055GhN6MOv2zi5OyQTsRuWJxrkXlZMKLFDYFk5xtcISyu7wRtW9hxryffB3r1cQo4pBq1SvQAHdqVcnwOZpwH2TmZ+ARVFCP3bqz01g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi, This series is based on [0]. This patchset adds support for case-insesitive file names lookups in tmpfs. The main difference from other casefold filesystems is that tmpfs has no information on disk, just on RAM, so we can't use mkfs to create a case-insensitive tmpfs. For this implementation, I opted to have a mount option for casefolding. The rest of the patchset follows a similar approach as ext4 and f2fs. * Use case (from the original cover letter) The use case for this feature is similar to the use case for ext4, to better support compatibility layers (like Wine), particularly in combination with sandboxing/container tools (like Flatpak). Those containerization tools can share a subset of the host filesystem with an application. In the container, the root directory and any parent directories required for a shared directory are on tmpfs, with the shared directories bind-mounted into the container's view of the filesystem. If the host filesystem is using case-insensitive directories, then the application can do lookups inside those directories in a case-insensitive way, without this needing to be implemented in user-space. However, if the host is only sharing a subset of a case-insensitive directory with the application, then the parent directories of the mount point will be part of the container's root tmpfs. When the application tries to do case-insensitive lookups of those parent directories on a case-sensitive tmpfs, the lookup will fail. For example, if /srv/games is a case-insensitive directory on the host, then applications will expect /srv/games/Steam/Half-Life and /srv/games/steam/half-life to be interchangeable; but if the container framework is only sharing /srv/games/Steam/Half-Life and /srv/games/Steam/Portal (and not the rest of /srv/games) with the container, with /srv, /srv/games and /srv/games/Steam as part of the container's tmpfs root, then making /srv/games a case-insensitive directory inside the container would be necessary to meet that expectation. * Testing I send a patch for xfstests to enable the casefold test (generic/556) for tmpfs.[1] The test succeed. You can test this patchset using: sudo mount -t tmpfs -o casefold=utf8-12.1.0 tmpfs mnt/ And making a dir case-insesitive: mkdir mnt/dir chattr +F mnt/dir [0] https://lore.kernel.org/linux-fsdevel/20210323195941.69720-1-andrealmeid@collabora.com/ [1] https://lore.kernel.org/fstests/20240823173008.280917-1-andrealmeid@igalia.com/ André Almeida (5): tmpfs: Add casefold lookup support tmpfs: Add flag FS_CASEFOLD_FL support for tmpfs dirs tmpfs: Create casefold mount options tmpfs: Expose filesystem features via sysfs docs: tmpfs: Add casefold options Documentation/filesystems/tmpfs.rst | 37 +++++ include/linux/shmem_fs.h | 7 +- mm/shmem.c | 205 ++++++++++++++++++++++++++-- 3 files changed, 238 insertions(+), 11 deletions(-)