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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9481D35688 for ; Wed, 28 Jan 2026 07:16:18 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4f1D8d30Txz2xT6; Wed, 28 Jan 2026 18:16:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=113.46.200.219 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1769584577; cv=none; b=Fo26mF6r+CYIAN/2OFHhPvv8SMQ/PTqqpAaTDvbEs+bLyfLNuBFBhmm0dRq5J5wHbtL17lvMkYFox6pKx1H8N6mQ1QGFi4BqyFlJb2vOPNk6XAeuHBZW1CMq9KNqSc5o2Yak8XbjSy4Zku4xT30wpBLE495wHUMCXc9Gt/ZYBfmGx7jFLMPd1DfaNqWkjnSf3Xc+Tk3i/jF5bSARylZQZ1+w+J/R8HD9d7Vuk9If5Zs9YlIPByB3RGY5bp8qPvcq98/kdAVv5uNyerNNDYqFYdd1NpxbAIQSRrpP1+FidJKcCy7xz0XrOmzrs8x3axBzFtFkLOuEzOfMODl/3/7N7w== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1769584577; c=relaxed/relaxed; bh=2agBpk5Okek288d3EdZ60BSPzu1QRxP0bRarNzWNgaY=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=fTGQtqto5Gh/IDG+OdnSLwOxdilN9SUNIyA9o+n/1n8uMlg2MKkr2E227XYD1HN3THUPhaCXtiRZMfhIzJ9Y94Lyv/ywjiJxYHRctuRWY7sZ+Hd9hHskpnkv80uCC5yckt6OYA/LsGzYid0+Be63HUkEyxw+ydnqXsZVx0X4mghPTdejeKliQj9YJILPFe8QuiHQYB5lLXa2kmkAhFZMFk9pWnBQk9pXjkKWoJyTGvtJ4NR3n2EuJRIFvNtzp5RseDcU6a7/oenLm5GSF/tlQ6NghrXqHB1a/iB/tP1FrUBa6j4XOOUsCC7prajeGqCspGajryIEvBBfC08Hc4aw+A== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=KaPrcUYl; dkim-atps=neutral; spf=pass (client-ip=113.46.200.219; helo=canpmsgout04.his.huawei.com; envelope-from=lihongbo22@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=KaPrcUYl; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=113.46.200.219; helo=canpmsgout04.his.huawei.com; envelope-from=lihongbo22@huawei.com; receiver=lists.ozlabs.org) Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4f1D8b3XF3z2xHt for ; Wed, 28 Jan 2026 18:16:14 +1100 (AEDT) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=2agBpk5Okek288d3EdZ60BSPzu1QRxP0bRarNzWNgaY=; b=KaPrcUYlUbBKV+SO7DO7QuAd9+joIp6bdipxeBjZ57kIipCNYTKKfXTiTitBuYkhz9OShkmW7 X3OuI2PquibzU5I1YvioXIrhCLC/6XZpLXu4ZkI08PsPLLRzEHA4Lf+mcbS+KMEFR8GY4dgB748 g6EJJBoSraJA6SftIxQqNYs= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4f1D4R4mPsz1prkq for ; Wed, 28 Jan 2026 15:12:39 +0800 (CST) Received: from kwepemr500015.china.huawei.com (unknown [7.202.195.162]) by mail.maildlp.com (Postfix) with ESMTPS id 7673240538 for ; Wed, 28 Jan 2026 15:16:09 +0800 (CST) Received: from [10.67.111.104] (10.67.111.104) by kwepemr500015.china.huawei.com (7.202.195.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 28 Jan 2026 15:16:09 +0800 Message-ID: Date: Wed, 28 Jan 2026 15:16:08 +0800 X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] erofs: use inode_set_cached_link() Content-Language: en-US To: References: <20260128045854.2266287-1-hsiangkao@linux.alibaba.com> From: Hongbo Li In-Reply-To: <20260128045854.2266287-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.104] X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemr500015.china.huawei.com (7.202.195.162) On 2026/1/28 12:58, Gao Xiang wrote: > Symlink lengths are now cached in in-memory inodes directly so that > readlink can be sped up. > > Signed-off-by: Gao Xiang Reviewed-by: Hongbo Li Thanks, Hongbo > --- > fs/erofs/inode.c | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > > diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c > index 2e02d4b466ce..6afe487eb9be 100644 > --- a/fs/erofs/inode.c > +++ b/fs/erofs/inode.c > @@ -8,21 +8,23 @@ > #include > #include > > -static int erofs_fill_symlink(struct inode *inode, void *kaddr, > - unsigned int m_pofs) > +static int erofs_fill_symlink(struct inode *inode, void *bptr, unsigned int ofs) > { > struct erofs_inode *vi = EROFS_I(inode); > - loff_t off; > - > - m_pofs += vi->xattr_isize; > - /* check if it cannot be handled with fast symlink scheme */ > - if (vi->datalayout != EROFS_INODE_FLAT_INLINE || > - check_add_overflow(m_pofs, inode->i_size, &off) || > - off > i_blocksize(inode)) > - return 0; > - > - inode->i_link = kmemdup_nul(kaddr + m_pofs, inode->i_size, GFP_KERNEL); > - return inode->i_link ? 0 : -ENOMEM; > + char *link; > + loff_t end; > + > + ofs += vi->xattr_isize; > + /* check whether the symlink data is small enough to be inlined */ > + if (vi->datalayout == EROFS_INODE_FLAT_INLINE && > + !check_add_overflow(ofs, inode->i_size, &end) && > + end <= i_blocksize(inode)) { > + link = kmemdup_nul(bptr + ofs, inode->i_size, GFP_KERNEL); > + if (!link) > + return -ENOMEM; > + inode_set_cached_link(inode, link, inode->i_size); > + } > + return 0; > } > > static int erofs_read_inode(struct inode *inode)