From patchwork Wed Nov 20 11:20:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 13881065 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 0643FD6392D for ; Wed, 20 Nov 2024 11:20:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 917BE6B0088; Wed, 20 Nov 2024 06:20:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A03C6B0089; Wed, 20 Nov 2024 06:20:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71A7D6B008A; Wed, 20 Nov 2024 06:20:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4E8F66B0088 for ; Wed, 20 Nov 2024 06:20:55 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 00D72160A0E for ; Wed, 20 Nov 2024 11:20:54 +0000 (UTC) X-FDA: 82806228624.13.7B25320 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf12.hostedemail.com (Postfix) with ESMTP id 114B94001B for ; Wed, 20 Nov 2024 11:20:29 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aH8KFZnP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732101517; a=rsa-sha256; cv=none; b=U7vdWQrMlARtPPMzmjFAz6S912RpBIw7CPZlJOz/zFFvogV3TRSiXlW7xKyX/IbW09kJxL 3jYhQRhOWAHaJnxS0G2DUxue/ak/AZmXJm0PU0HQVrfjxzib5lvkyKCP3EhAgrsmaK5LqH TK6HeqgoyTcMHJbfQKydc4WuZmYGkRc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aH8KFZnP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.218.44 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=1732101517; 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=YMDpr51HGMdjTn/zZt2QmbhLNhc4xxoRwRH832sAaPM=; b=1/zq/bIv3KvQLJr3cqkEqZLbTxSoBaBsOP2WYemIM9zp/R5cU1Ly8vNDMnyMOAs5d0LvS6 9/Ogn6oeqkmUDubRJ6AQw4M2fZp+mQ9iVc89fQeaQPy5QpvvCDJqZOIIUtQ5e6d0bAIQId QIes9HSggrTfgTlqeaUXQ9L49RAV+d8= Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a9ed0ec0e92so584991666b.0 for ; Wed, 20 Nov 2024 03:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732101652; x=1732706452; 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=YMDpr51HGMdjTn/zZt2QmbhLNhc4xxoRwRH832sAaPM=; b=aH8KFZnPhgrTeVHZ8X1sT56zQez1aXy++qrZBfECt5iUJ6Uei10HwOon48X3ALPvxl uCUA4oo33amJxw8yjC8hWEardEYekzJgP0Ez65iTpjLi7N03RDeLQITfRT6ck6lu1ds0 h1sR1UaV78ZxcwJzv2Nta9RnjRJZ6EnHK/5ZAiFERR4QfZDTsyzu3X6xRgyrI/Maz3ga wVFtLI1nloCoRFe8fn78nE9qx2stOBdfxQYQH2vDFyXeHXblZahlgfhes8SZHpEWabNV pnPZ95tC8XGrbR7iSV/i67UVF5/lysi03/xYbGNt2cWeGrQolTRvT2bs++5rkLAMWsMX 9srQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732101652; x=1732706452; 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=YMDpr51HGMdjTn/zZt2QmbhLNhc4xxoRwRH832sAaPM=; b=fAayyCRsS/vm/MqzjrJBQ+MEL1ubBnIqpZQoG63j3UkchD+jQKoM6eLtIO4Nrs4P1Z 4zkeVLJLemzCKd81uvnOOZL9iIo9rzyk3vTv/wL2vg7yyvL0TsGbSFQF5QLjrLNa+eTt Fyf/Cf0Ic1TUTqFcZg4oIT1BWUbQk6Tj6rabNcvpr5LWDvmnHPK34MQqaHE/JK7JDj3R 0i6b96qh+oX52/uLpItogWnZcOSAdyoqKiIggK+PC8Yk1HvucfC5J1rNiviJTBeWgjV9 MaPA0yt6ITryY5NJhTFjhw8/hihU4a+eG2yS5KgsgaP2PxHzR5QUI5bKgmAtEwqvdKGP Fu3Q== X-Forwarded-Encrypted: i=1; AJvYcCVEIrEEpHzrG7meWHBRd3drjZqgmHc/ThwiW3VKniiZcWzHMpu0Zn/xznPtRAkLg8js3aK0wFVvBw==@kvack.org X-Gm-Message-State: AOJu0YxUWutXtI1KHkyqS1KwR9FM4212uGGTHfGz37eIH6tTf0CyFde9 TwplgYzZi+hWkgmV8N3iRM9oeryCrFuXpCUawX2wmprdvH8WcESC X-Google-Smtp-Source: AGHT+IGME9zrR7PEmCppueSU0EVvlvlY9LrKb85f85FZGjKra7l7vMMQegldnpEbAzUI5fVhjh2VUg== X-Received: by 2002:a17:906:c102:b0:aa4:7905:b823 with SMTP id a640c23a62f3a-aa4dd6b0c82mr252771066b.32.1732101651378; Wed, 20 Nov 2024 03:20:51 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 03:20:50 -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 2/3] ext4: use inode_set_cached_link() Date: Wed, 20 Nov 2024 12:20:35 +0100 Message-ID: <20241120112037.822078-3-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-Rspamd-Queue-Id: 114B94001B X-Stat-Signature: 4718mhszduke9ya9caca41wb973jsbsh X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1732101629-348920 X-HE-Meta: U2FsdGVkX1+dEB55h+itDXeasq9a6oVv2u1mBynfE9BlxCd9nwum36HKJ4l/+QFIiynGjo5eBhaqwg0QfnTG1qzxhhGuql3RoU0cY5yQtb0F6Q0Rut/kvMFuJnGQDTpTeexCS/Iyh9nuLIWNPr8mjdzUK2IWXIB1ANIbd2gPo84JfuYKVNiBqPtI5/fj1z98Eqf84wltfl1Qp4zq7CKuzfsdIdq/h71v7T6stczY1h2Xnnml4n0mfcD9KZvPSBsTfPQK+x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oDB5nrn0nBoZ+7qIhvZuGcc/MyjEbE4Ochmg+nCZuCXBHQyQ7Le9tH0kfsRP+w5gMhgaTZA= 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: Signed-off-by: Mateusz Guzik --- fs/ext4/inode.c | 3 ++- fs/ext4/namei.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 89aade6f45f6..7c54ae5fcbd4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5006,10 +5006,11 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, if (IS_ENCRYPTED(inode)) { inode->i_op = &ext4_encrypted_symlink_inode_operations; } else if (ext4_inode_is_fast_symlink(inode)) { - inode->i_link = (char *)ei->i_data; inode->i_op = &ext4_fast_symlink_inode_operations; nd_terminate_link(ei->i_data, inode->i_size, sizeof(ei->i_data) - 1); + inode_set_cached_link(inode, (char *)ei->i_data, + inode->i_size); } else { inode->i_op = &ext4_symlink_inode_operations; } diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index bcf2737078b8..536d56d15072 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3418,7 +3418,6 @@ static int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir, inode->i_op = &ext4_symlink_inode_operations; } else { inode->i_op = &ext4_fast_symlink_inode_operations; - inode->i_link = (char *)&EXT4_I(inode)->i_data; } } @@ -3434,6 +3433,9 @@ static int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir, disk_link.len); inode->i_size = disk_link.len - 1; EXT4_I(inode)->i_disksize = inode->i_size; + if (!IS_ENCRYPTED(inode)) + inode_set_cached_link(inode, (char *)&EXT4_I(inode)->i_data, + inode->i_size); } err = ext4_add_nondir(handle, dentry, &inode); if (handle)