From patchwork Wed Nov 20 11:20:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 13881066 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 707D8D6392E for ; Wed, 20 Nov 2024 11:21:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBC9A6B008C; Wed, 20 Nov 2024 06:20:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E44D86B0092; Wed, 20 Nov 2024 06:20:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C98146B0093; Wed, 20 Nov 2024 06:20:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A65C56B008C for ; Wed, 20 Nov 2024 06:20:59 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 52942C0A7E for ; Wed, 20 Nov 2024 11:20:59 +0000 (UTC) X-FDA: 82806230388.16.3986E44 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by imf10.hostedemail.com (Postfix) with ESMTP id B799AC0005 for ; Wed, 20 Nov 2024 11:20:34 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iZHYaoCw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.208.48 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=1732101566; 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=kLyrUQbJ7DreZ+2eCL0QXJjGPutHdXgYXLv04PixPtY=; b=mfcW8si+aMlNXiqz9x78iOYUeNvGCUcN884IwtmQyoF3Cwnp2jfyY6WKOJzGd9Tw9W31e0 uZi01ggKYTdBv37EWWB1O984mEmuuPWxoMOJfpflxrbB0Yr+Kd9sELDAmwoQsFSQgW6nnb lb+Nu9NKww5wlI4P6lxq02XwXEZSBek= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iZHYaoCw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.208.48 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732101566; a=rsa-sha256; cv=none; b=GiNQDxvgdoJBXU7tDKjAASYUSE8EW1k2gUcDoljJQ4V/IsGc5V0AWabFTXm079ntNJ06QE Or/jsfy9smzlFq7XWm1780tLrzbSQWhA8Db6uPEpENeBmebzy7IL7xWy/yH83zhNkCMPdU Lgaccte5MUZni1dLrI4rd7qsBRjNOMc= Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5cece886771so1480680a12.0 for ; Wed, 20 Nov 2024 03:20:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732101656; x=1732706456; 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=kLyrUQbJ7DreZ+2eCL0QXJjGPutHdXgYXLv04PixPtY=; b=iZHYaoCwkxzCl6LkZ4sWdJmLkv83OvG1YUYdF1pEQApiAI5hdZSIo9muPhsEiwQVhu ubn9Ny/MdhFJ8/rrbDuDKIrHBDK2xXSVEzIEks/IZko9ms489/U8s7ZxInqYYi8m9M5L VkcSn73GC7a+I6W+oXWyX8gRN4yT7ooVd3xmBmO6Rx/muFCVmWqc2FLydXOhSrt6tTl+ MMvROKpHjt1Us1mHWONkETesqbCneel85ackkMcYS4B8/sO7hXHzu8+lgZP6mnFOOaM8 PiPS+u17g8qST/J5EHC5G/0zHOHMAEhHWdhzUYEnMSThBdhPLRlMT9zgE5dyeOymS6jc 7baQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732101656; x=1732706456; 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=kLyrUQbJ7DreZ+2eCL0QXJjGPutHdXgYXLv04PixPtY=; b=PnEyXgm7Azj12zVlCBhldMLf1OJDTkw5WjTpmzxFf4QcQqt4TPXgsRt9BkKKw9KYHi 6ZJad0L/7wY7+ANIGZNV5JBZAX3CvjaGRMcxHyF6YZnCVpevNYhlVvhsx4PUZt5H6hps /gK6xY6FoLZp2kTEGVVd94PD7m+JuCgpiY5RVgai22MI9iv/u+rDVf/N2VtwDhugzs1n HcuwmxVtHG9RNEwMw3Un7PoCIDUnr3/cn0mEtnMp36aQ7tCJdpEaOIJ4p44AUrn7dJrX b+8h+MX9JwuaJps8/uNCYG8CmnHxN3BMY0pj9bj3kqmbacqcbktYeC1Rx+QvIWULKKwF jppg== X-Forwarded-Encrypted: i=1; AJvYcCUoeKU0Rc+/c6L0WBTr9BJO80rkQwXFrKnDlE8hZcgoRswSjnlxJ4k4J2NMMB8961tocXU0iRbH9A==@kvack.org X-Gm-Message-State: AOJu0Yyx8NpZgr4tzI4DrwA2yHhGGYIwBUJ3GrGBIYAzsr873XS7EErI a6tcB4hyzm+CmM+j2mgad9gkSjLcENu2GDYwAaS91DoStokxjZPd X-Google-Smtp-Source: AGHT+IG7pW3Dxr7KS89kSKjBWsHbI31GbaM1tb6J62zSZ1xqBnHqjvWaYalwKIjlxD/g6vIF9K38rA== X-Received: by 2002:a05:6402:320c:b0:5cf:e218:9b08 with SMTP id 4fb4d7f45d1cf-5cfe218aad9mr5811934a12.15.1732101655755; Wed, 20 Nov 2024 03:20:55 -0800 (PST) Received: from f.. (cst-prg-93-87.cust.vodafone.cz. [46.135.93.87]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20df5690csm758559566b.75.2024.11.20.03.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 03:20:55 -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 v3 3/3] tmpfs: use inode_set_cached_link() Date: Wed, 20 Nov 2024 12:20:36 +0100 Message-ID: <20241120112037.822078-4-mjguzik@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241120112037.822078-1-mjguzik@gmail.com> References: <20241120112037.822078-1-mjguzik@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B799AC0005 X-Stat-Signature: 31mkzuzxro8j4fih6i5h5qimxsc5aky6 X-HE-Tag: 1732101634-740329 X-HE-Meta: U2FsdGVkX18ZxriAGWdTdJ3PICTOfIMZJ13NOB+i4TLHWsdSVbyWeT+rO3P9refmfjiYZx86kGZYixzqqgptBaK0KtLtitzKH4UeMtXAO7Pj+ZQPjXuXhBQT3zEzvwraeK6W2K6yUVkKyYH7PGguq18jAtOPuS+OZxe6bi49zjnOm6Ph517dJTLSBUFd5fvIXOXpKISNP3+A6iR+ntQikzsqhdLxSSFO4Q3Ym++IcVuabKHWv0IyNoUHnzni6zeiuRp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5TCFf/h3MAFIie8FtAMnpEOgHrUDTlN3tJ0I4PcxKNA01PvxMinXAJTZmUYtHGwnq2YU2NUFJHWrgitfEULZ90IkUks= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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 c7881e16f4be..135f38eb2ff1 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3868,6 +3868,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) @@ -3889,12 +3890,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;