From patchwork Tue Nov 19 09:45:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 13879533 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 7A653D6204F for ; Tue, 19 Nov 2024 09:46:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F25476B008A; Tue, 19 Nov 2024 04:46:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ED3FC6B0092; Tue, 19 Nov 2024 04:46:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D26F16B0093; Tue, 19 Nov 2024 04:46:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B2E646B008A for ; Tue, 19 Nov 2024 04:46:23 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 41FC01A02FF for ; Tue, 19 Nov 2024 09:46:23 +0000 (UTC) X-FDA: 82802362608.21.4A3B398 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf10.hostedemail.com (Postfix) with ESMTP id 43688C0005 for ; Tue, 19 Nov 2024 09:45:59 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=nk9XyAqX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.208.42 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=1732009490; 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=NrbipnhGiulntBVTDYmN63nSkAsI19F9W2e2KFO2CXybFIlg30U6QCcm5mqxQbKdHnFqR7 +eg7c+5wbDTXrzH8ARjo9B4sQFhVRGkPjZOgZHUNwT9Nnqzh4f+X0P8bIsiWmeoezTAOa6 nkeFm4uY0S0cHZnBj4Clif++nIZA2GQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=nk9XyAqX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732009490; a=rsa-sha256; cv=none; b=NjTDRuZ9nxyz+8A6vgJTWFxe3zeAzB2iqZVy8DINeFwwuxXJJbBR27st3ljJXszfv9AMQp zs3J5D15MlMoAbd0Aw/jHaExbxFc1Y7vt5lt61VYswQVJHPFIRpMtxNex8LhdEl8Koinbu 0XtwYYmCadjnsPsc4gvJRrpT+CoPr0E= Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5ceca0ec4e7so748948a12.0 for ; Tue, 19 Nov 2024 01:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732009580; x=1732614380; 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=nk9XyAqXXn9PcUvsr7+T2ecDISd9TTnrOS7K6TyOaaYZQysPF3Y9xihrLHf5La/W5S 7svjTLOc39EP75KcQ4Gaj4/wuLpWUSkZb9hJ2aFZm+AXuADZFZ3akN9CqbOq1x0By35P HzA21zVMRYOd7U5a/iyJuVwW6+EKoUboV5JN0f7sQTjS5mDgD4U02jIyyBAOFYr+W0cN CRTHdJgYbwbQetGeB6N83ZHvrf585P9ZHvma8cfMRhkbK9wyvss8CkM36XcTed4VDp8l 48kc+YQpNp7iNXj+rltU15SAI+t0vkOloCUQZkGYtC97W5/6w0gMEHauE8AKVTm3BMJq gtCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732009580; x=1732614380; 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=KPCrGL95UeZhZAnpZ+ZQByC3Vk9+Pmt+5oJpare+xAb1wS9s/zNaD/neetFRJt2hBd wOBjf//mUN8oFAiBKqyu0trpr/ZNEP5t2DfBT9XidWA1zlAj1IqNQOyK8j+P4myH760h zx5/0d79mtfugafXtXxQoli1VTlkqYdJUJ8fnpiGSHYS1XZcrM7QIhP3yodi6zUctOJa +Xm90SjdgRPPU/ElM//MXJ/xJ2J9XD6RdfQFi8pr8csD0AapsAv+NoKC11kA0kl9R7p0 ARRhGi01WwzrIm/JG7D+inXeQVfHy3AhzOkp+xFTC17SgogwHKmRHwSobFYcB+nGZPsC mR7w== X-Forwarded-Encrypted: i=1; AJvYcCVQNEg48GoLzRPnM+ucPIhprxsrlUVE3nWObdZS/Fh6NE3nMb8uNCB6pgcBGAfM/65NZGrLUjlPuA==@kvack.org X-Gm-Message-State: AOJu0YzsNIdkzHeHCjKv1ka5gn/cmjEGGoZziJflCnLDFik2kzXGUGEt yx3t9SvTvfLEle++elMJ388yFks54pB6XxEWUmPfYX2HsI9haEvJ X-Google-Smtp-Source: AGHT+IFp88Ev/g5mJ8o8R3VYOBPpM+QA5xyPCCcIu8wbpjjrR5KO7r2Uhp+NQwM/bCB9W1Ce+c9J4A== X-Received: by 2002:a05:6402:34c5:b0:5cf:bcc8:f490 with SMTP id 4fb4d7f45d1cf-5cfbcc8f8d1mr7093276a12.11.1732009579773; Tue, 19 Nov 2024 01:46:19 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 01:46:18 -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 2/3] ext4: use inode_set_cached_link() Date: Tue, 19 Nov 2024 10:45:54 +0100 Message-ID: <20241119094555.660666-3-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 43688C0005 X-Stat-Signature: n8qurhniwwdtqta47j5xaeye188p1tub X-HE-Tag: 1732009559-988087 X-HE-Meta: U2FsdGVkX19hQNtpWG/xV7JVLQnTnUshzmYyvSEh7IxVT9FyomnJ+pGquPZgbTzSozlFNyd1BFTOZi43iOBA7DFr9IL7kiR5FlPhSb/03vTWGcweD1HgzdSYPaPWDCmNL4Wpy/kEGkOBPt2+QJHex70cnnIspbIH/XWaqufTR+TTIXgfJ+KuHVsPH06048oLC9RqIqxhDuRy+9cT1qFWAC41dPYR/GS83X+UpR6kP2/rgCLL3YpMQB4P8f4+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RLfXOn6+hAghOKlpFlBI3SPLmEBDOTe6ecXZoWSZX9LLTyynTk3MLz3snF5NToKqCdYY4xCPMqdMGqsIWvswM= 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)