From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796029053; b=1P1VsWz8EIMIn0zkNzCR9IiYAIyln8uBUYdGIyQ/W2zGdbL4z3WKmQEJsmJsTbWBYGpa 9WGANDib4adUtHilPiJ4clrEmQXeCmrXoG3BeNqWRKw3Gxxhws3zaQ7NgyfhfpZGMD2bj 3wkfsoqK407WuSgvYzU1S2vqNDUjZVoSRMXGxdVRD6y2xrrp2M3Te7bUF5EYviX9Md6pa lO2wu86sKk+Ac/6tLIsBN5F1eYjxT50HwiXTQfraF7fi/rCKy9wAZhMno7XLYgn1jZluZ XXAsg5aGWLNEV8SsNYy+SLn4oC4uVghLTsQNDh6H/sX8zH9dMHXoUJF3ulBQqUxBogA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796029053; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=mmemuGHPLDGG4CWZE/a4M9oEUTVN9sMwuPE9c3oQiew=; b=1jG9mn01Kr+OPMbOyrMO33d6GFErFHWg+V7L9FLSS5BnDqOGTApmVgLg6IWQKRfFaVPB HmTxqWmKvIwAHwCMDC+SR/wqux6fL6jplLsu7DoYYiWTlH7XtuigunhFyuFzOLNUgfWS/ ovNpLvPqQ483e28V/B97fDDmBYIPuZFYxlBSD0JtU8332aryW3Oz0pWD84HwiRqOgeJFV 1P2jDIHZphPWEkf5UPt1A3vRIMtZVim+xS6C5Fu73vENSE/qEMgdtgbDths70AG0c8WDb AzdVQA9gcbcvyjxWxyWBhIUZwEkKc0wTq5kbwFebnWtY5jhUmAkFLs78hny4q707rnw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H7+TXUQn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30835606A338; Mon, 30 Nov 2026 08:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H7+TXUQn Received: by smtp.kernel.org (Postfix) with ESMTPSA id D41331F000C1; Mon, 30 Nov 2026 08:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796029052; bh=mmemuGHPLDGG4CWZE/a4M9oEUTVN9sMwuPE9c3oQiew=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=H7+TXUQn1N1j3V7WpcSrmO0MF3DUMqkkW1DATnV7LSt+r/i/acHPvquwPIG6K8Tcp 0oJ1CJgTF4pEPl5FzfVo8VQVucBqCkcI6GagAgUbVGZ78HU8zNybuappllqCUH7r0z tbyrIrbAC8ETXN8oCH5oXRrWMjeTuPhlilR69kIACFZAhJCqYi25L5vaz6tWnS0kjT H9WD0Cs62kf/JDSZtaQZfgfjkBhPnmh2OUWi8h1H+vNrMiajxGwXiD/bU4jEus+ZGH JnOciIQtpGgslaZ4XLIv97B71ZDN22f6PG4pRKWv9u4WfCezgqXK6TlnrnZo8iOnZe NDlE8d2iQX42A== From: Christian Brauner Date: Mon, 30 Nov 2026 09:57:06 +0100 Subject: [PATCH v2 1/6] fat: add fat_new_inode() X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-work-fat-tmpfile-v2-1-99af97d95683@kernel.org> References: <20261130-work-fat-tmpfile-v2-0-99af97d95683@kernel.org> In-Reply-To: <20261130-work-fat-tmpfile-v2-0-99af97d95683@kernel.org> To: OGAWA Hirofumi Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, "Christian Brauner (Amutable)" X-Mailer: b4 0.17-dev-04696 X-Developer-Signature: v=1; a=openpgp-sha256; l=1995; i=brauner@kernel.org; h=from:subject:message-id; bh=EGHPkwPrgHlarRS8P+DV2hvbuRJoCIetFaCWSPA+Qjw=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWTzWhU4ep5aPvNJqIZx8KLLHNvubDbbVa7ub+qu+7IyO +XzZOPMjlIWBjEuBlkxRRaHdpNwueU8FZuNMjVg5rAygQxh4OIUgIm8F2FkeJ163CdSrl1o1o6A zYKLGP+0tZx0/aDbzCN09cfjhmO5jQw/GbMsHO6GH/9UuUpsippuoHCi+1/JQ5O8TN6o/9+sdeI nFwA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Move allocating and filling in the inode out of fat_build_inode() into fat_new_inode(). The O_TMPFILE support in the following patches needs an inode built the same way but without attaching it. No functional changes. Suggested-by: OGAWA Hirofumi Signed-off-by: Christian Brauner (Amutable) --- fs/fat/inode.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 642e690632d83..25b9d8e3bb7de 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -582,6 +582,26 @@ int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) return 0; } +/* Build an inode from @de without attaching or hashing it. */ +static struct inode *fat_new_inode(struct super_block *sb, + struct msdos_dir_entry *de) +{ + struct inode *inode; + int err; + + inode = new_inode(sb); + if (!inode) + return ERR_PTR(-ENOMEM); + inode->i_ino = iunique(sb, MSDOS_ROOT_INO); + inode_set_iversion(inode, 1); + err = fat_fill_inode(inode, de); + if (err) { + iput(inode); + return ERR_PTR(err); + } + return inode; +} + static inline void fat_lock_build_inode(struct msdos_sb_info *sbi) { if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) @@ -598,25 +618,14 @@ struct inode *fat_build_inode(struct super_block *sb, struct msdos_dir_entry *de, loff_t i_pos) { struct inode *inode; - int err; fat_lock_build_inode(MSDOS_SB(sb)); inode = fat_iget(sb, i_pos); if (inode) goto out; - inode = new_inode(sb); - if (!inode) { - inode = ERR_PTR(-ENOMEM); - goto out; - } - inode->i_ino = iunique(sb, MSDOS_ROOT_INO); - inode_set_iversion(inode, 1); - err = fat_fill_inode(inode, de); - if (err) { - iput(inode); - inode = ERR_PTR(err); + inode = fat_new_inode(sb, de); + if (IS_ERR(inode)) goto out; - } fat_attach(inode, i_pos); insert_inode_hash(inode); out: -- 2.53.0