From patchwork Tue Nov 19 09:45:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 13879534 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 442E5D62060 for ; Tue, 19 Nov 2024 09:46:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D293E6B0093; Tue, 19 Nov 2024 04:46:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CD7E76B0095; Tue, 19 Nov 2024 04:46:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7BCE6B0096; Tue, 19 Nov 2024 04:46:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 97AB46B0093 for ; Tue, 19 Nov 2024 04:46:27 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 12255160300 for ; Tue, 19 Nov 2024 09:46:27 +0000 (UTC) X-FDA: 82802362818.10.A401B37 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf19.hostedemail.com (Postfix) with ESMTP id 4BDBF1A0002 for ; Tue, 19 Nov 2024 09:45:22 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=T+XRjGqf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732009450; a=rsa-sha256; cv=none; b=tKijPR3MIIjBj1zqUaC7jf5oWYD4cfIohUwYu68XXO7ZXBjYPXSVpcdeWc4qJ87sx/H8rB /5RNAo1J3vGaxjdcSgQBubIEx4syVanHr9Sc1TCQPJi7QWXRiFSeBEjx/GXRWymiDf4a9y G15+tC8D0Lp3D4BMaopL8RJkTmoQ8dY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=T+XRjGqf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732009450; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gRjdlYzPvkDGyceNUheL6XnbeGUmofPVBhVXYJCZjS8=; b=20TdDau3rTF9Ijm1p9p2jXMYK3ExutQ9zTNTjIqHvm75Q4amgnZu8U+1/0SWPlvBvzT5h8 4YXPjtH47ipcEkoiANzmwtP4dai0qSvMJFRIPvm3G27u6MA7Y3SY/uopXaSKuQc3C3SatZ 8QSP0VKcCdJBhXRVAoCJiuRBunFvNNY= Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5c96b2a10e1so1144766a12.2 for ; Tue, 19 Nov 2024 01:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732009584; x=1732614384; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gRjdlYzPvkDGyceNUheL6XnbeGUmofPVBhVXYJCZjS8=; b=T+XRjGqfhxM0n5XmXCeuhspeZHY6xb1MLrCqWTAck93Ij3e/WAyRvyBSiMtOMI65oA dQEOiVwZ7QhzrBPjkajKFD5o2Qj69NAI6ni6lCedDL7C9PVPIB7uPyBbAtdu2AmzS0v7 RYKe943zgMsnM3oPDOTLVWqPczTjcmkPbv/P4pAvWzY3v2jIc8pRk+wHVOjSA36hWrAB EANys1ePDVMLT9lAkaG5RQ+zusLhOCnzmPMCGMn2zddwhoy86Fk1XtYZ2RGDz7Fk9z/v 2WxN3QnjLVPirFv8lp6yxPnq+Yp9v368DRdj2meLtOIgppYH4NrTAaMUEzIiHJ5FHU9M 7C5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732009584; x=1732614384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gRjdlYzPvkDGyceNUheL6XnbeGUmofPVBhVXYJCZjS8=; b=GRkey3YtB9plcA1w2Ikdrh4p+xiEUJJUfkOGKd8ksF9uwwkL4FCy0kf305DYh+u7AM rH+HhKNOL5RhoL6qqjitZ33MYtDFUEyCrgRPOq/LXB0XeWOc0MBDoLz3LpfgOztVcWEQ nO4lV92p92fzoGdhM6DgSR4ahxBa1AijlYnz43IJ/HhuAVN1WRztn+mUfyDYObxDi/Nh WoDu+THNWJlm8jrnMxnzM5vE+bxp7Gf5rU1VTCChyT+5KkPfGJCE4gSDH1gBq5pKjbfm mMvJI2uD8aFjnsOVqpg/LC3kFDIRmHf1iaYf2aGDVXEu5iKjyoUwtXZ1CC/6vsLY+wDo w3dg== X-Forwarded-Encrypted: i=1; AJvYcCXLcAfbsQwm7gfqn/scbKsyzGv5zVPGStrNvdtkM8SkBV1OZtHsPk5a39Hs6pIa4joO2uK/opwMlQ==@kvack.org X-Gm-Message-State: AOJu0YzXPx1QM+olLiffSh4Xg75ccmygUOcmMHlVHVRkWkvPfMxgkvvW IjGR9nArlCu1CMmtdr/jtmAoLLvTTxcUgj3APqMY/SfuEFHEbX51 X-Google-Smtp-Source: AGHT+IENGIigl1Ik7Rf/ZJmBgZi3Rx84+DKOI+SOYgqn4TNYTQoyphRR0vTCB3wZq2zJh9NolYXLRA== X-Received: by 2002:a05:6402:1e94:b0:5ce:af48:c2cc with SMTP id 4fb4d7f45d1cf-5cf8fcdfb82mr12601421a12.27.1732009583401; Tue, 19 Nov 2024 01:46:23 -0800 (PST) Received: from f.. (cst-prg-93-87.cust.vodafone.cz. [46.135.93.87]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cfcb3edce9sm1821154a12.35.2024.11.19.01.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 01:46:22 -0800 (PST) From: Mateusz Guzik To: brauner@kernel.org Cc: viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, hughd@google.com, linux-ext4@vger.kernel.org, tytso@mit.edu, linux-mm@kvack.org, Mateusz Guzik Subject: [PATCH v2 3/3] tmpfs: use inode_set_cached_link() Date: Tue, 19 Nov 2024 10:45:55 +0100 Message-ID: <20241119094555.660666-4-mjguzik@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241119094555.660666-1-mjguzik@gmail.com> References: <20241119094555.660666-1-mjguzik@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4BDBF1A0002 X-Stat-Signature: bprbtwy8m6qrqnp6dicpp34thkw8ujk4 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1732009522-11321 X-HE-Meta: U2FsdGVkX18coCI+BzTvb3dXpxCXMYFyeGCF/TrFv+vmJzhrI8EMCQ5PA7khjvbLkJEmBEb3ztxvQpzojpyhTc4eBrTsXBG0MOVrC5OLgdJBMN4ad2OdIW9fqBlwMHe7MAroUCuWIe2pYzCxi0GBMICfAsp9WWYUeqLaLcPGK4p19rDH//TCM1M5lKgOEfVTQlEPMEcGYcyR/ci4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rgNcNL23dgNGKzYUl+BZsgUtio1EWbJFl43Vq1nL7sa2DojvPe4hQT6yDgBq6Dey7gkxUF4dBjCLRYqOe9fezp2+UNnYhy6FtMOPShJa32y38cbw9o+4ZT/nCSVmk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Signed-off-by: Mateusz Guzik --- mm/shmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 3d17753afd94..698a4bbdc21d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3870,6 +3870,7 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, int len; struct inode *inode; struct folio *folio; + char *link; len = strlen(symname) + 1; if (len > PAGE_SIZE) @@ -3891,12 +3892,13 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, inode->i_size = len-1; if (len <= SHORT_SYMLINK_LEN) { - inode->i_link = kmemdup(symname, len, GFP_KERNEL); - if (!inode->i_link) { + link = kmemdup(symname, len, GFP_KERNEL); + if (!link) { error = -ENOMEM; goto out_remove_offset; } inode->i_op = &shmem_short_symlink_operations; + inode_set_cached_link(inode, link, len - 1); } else { inode_nohighmem(inode); inode->i_mapping->a_ops = &shmem_aops;