Message ID | 20230525055147.13220-1-zbestahu@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp145061vqr; Wed, 24 May 2023 23:16:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5R3OfsKvjeD6os5+FuUWPKCCsgZqgRxoyhTEHd5LdF5uhIYvbpybriKE9d+BQ6PdyMID/8 X-Received: by 2002:a05:6a21:6d95:b0:10b:fe06:97dd with SMTP id wl21-20020a056a216d9500b0010bfe0697ddmr12702350pzb.54.1684995364001; Wed, 24 May 2023 23:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684995363; cv=none; d=google.com; s=arc-20160816; b=qCZyTQYwEqGNY2HG85dlUnJ1XGQkEzVFr7INJSJ9725H88jwtviB1y6kKx+imjtCAD NZP4RBjae3u7c/3ms65IpC3EcOjzicM2KbJOYgjnZit90OKF36fseJQmTT0A/n60qnvY toRTOTFpbp6/igf96/HUBjUF9akxmwoRxoZDgEcwAzRq4rKoIzeNzlIVlgtZ9xfdsxt5 eEm4hRpVIwOt9u7LYLzpbQcC1bo22n7IJqKibiu1v6EsAmWE/dOjEh6A0lyYaZM8KHJO vm3g5WBYis2V6JGIF8wmdSvShWjeOK6htcw8/VUNgNq2NBKsSiwLmKE05q9xOVwfr/k4 sCKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=l7P2pViE0Pdm1oz/lthOVONUXxJhbAwJFigoZZnYI7I=; b=o26P4zFoIQ7D0lNQVwUC6i/0Z2plMgSwFcbUCezADJGq9m2c9eO5SY/+KdPXXF2huL b8x6SUL2f8ZMkl9dVBp66r/6hqjQsJVlVTqc+tfXtGj3afknHYV/mXox0A9J7lSYGq4b hVjoXkruXmdCH/0h5dvkl7MPU48oHs9SmqvGT9a7IlkxEk/M71Bm5QnpnFgosH+XheOc cmROKD9J+s/0VvNy8/vtqsEMkL6Hxuskb9Pd1rAIre3RVyvXubAvtc3gU6qTOrwtxxFy P94DAwydrkaFQ0TT/s06piE1P2VlBPeEaHLS8vKzT5LqDfrNj+Zcgr5Kmd4q65VdwZCd 3QRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dkzqX7I+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a637404000000b0052cb8690805si394750pgc.393.2023.05.24.23.15.51; Wed, 24 May 2023 23:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dkzqX7I+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235890AbjEYFyL (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Thu, 25 May 2023 01:54:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232087AbjEYFyI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 25 May 2023 01:54:08 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2628F1B3 for <linux-kernel@vger.kernel.org>; Wed, 24 May 2023 22:53:20 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-64d2da69fdfso2050861b3a.0 for <linux-kernel@vger.kernel.org>; Wed, 24 May 2023 22:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684993999; x=1687585999; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l7P2pViE0Pdm1oz/lthOVONUXxJhbAwJFigoZZnYI7I=; b=dkzqX7I+LHjgODgV0ywVKF5SLiBAzr+fGfCFf4pam8H9IH8uK2DHL9sYz1mJQS+T0j QGPRv+8atks+Kg3RkZzzt2nYCvFvKiycZ+lBKTZKBJc5LTFDvnHfJw/l+5PVDXEUzzE/ BxFMkUbVzc1Vi9KvP5BU2ypMquo3bkBJHMh6tNCJyVQAIzez4AeuyUq/xKQMkTPpLyv5 c6R27f2W1KANiiXX1d547hMrtCug7n26Pu25Wa0MtlQTwNC0Y7gfvKNlc7+iqX4uRNHM dNzlmlAuakASNyGw/L4BvGTGwzfDL8qBKcvQeMux0JDr6i1AbbgGi/18DhmFzz9SDLtp Kt8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684993999; x=1687585999; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l7P2pViE0Pdm1oz/lthOVONUXxJhbAwJFigoZZnYI7I=; b=bRiFizdfZ3d3CTq5mT4zmfMCx7UD1OJuhbC1AC7msNNSZlMbARnT3xMxbvyH0mECrD vVRvw/rbaA/3mqsc01zN8rpAHJk3/GcT3FkghVTYC0tJlzJ9sp+2MYcWtzNuQ/lWNhZf 4rarYY2ByPokrG3f8RsxyH7IB+OFAsAzSc+d5sD4Spu4XPuwx/GFinJNvZLzoh9quL12 mDMCtJMQVBB7dIgMszby+CnsT3+BYuqynUmkicmnS0j+rs7O9kpLtPKMBCQCDBgouQyj UNWeyRJsnqA/EG7Sv3O8dsxWSx7oX0xF7KkRS8d5EIAVG1kQ/uFrxOqugjkrMKLWlNFV 9AVg== X-Gm-Message-State: AC+VfDzblgq2fJFyQyBzYzqeZihqwuLMEU4KnMOOjv/lnqjhBdWnWdOb NGLwPyN769Jmqq5xS3K/6/g= X-Received: by 2002:a05:6a00:13a8:b0:64b:205:dbf3 with SMTP id t40-20020a056a0013a800b0064b0205dbf3mr7081362pfg.34.1684993999543; Wed, 24 May 2023 22:53:19 -0700 (PDT) Received: from localhost.localdomain ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id j1-20020aa78001000000b006437c0edf9csm415895pfi.16.2023.05.24.22.53.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 22:53:18 -0700 (PDT) From: Yue Hu <zbestahu@gmail.com> To: xiang@kernel.org, chao@kernel.org, jefflexu@linux.alibaba.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, huyue2@coolpad.com, zhangwen@coolpad.com Subject: [PATCH] erofs: don't calculate new start when expanding read length Date: Thu, 25 May 2023 13:51:47 +0800 Message-Id: <20230525055147.13220-1-zbestahu@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766845699036731825?= X-GMAIL-MSGID: =?utf-8?q?1766845699036731825?= |
Series |
erofs: don't calculate new start when expanding read length
|
|
Commit Message
Yue Hu
May 25, 2023, 5:51 a.m. UTC
From: Yue Hu <huyue2@coolpad.com> We only expand the trailing edge and not the leading edge. So no need to obtain new start again. Let's use the existing ->headoffset instead. Signed-off-by: Yue Hu <huyue2@coolpad.com> --- fs/erofs/zdata.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
Comments
On 2023/5/25 22:51, Yue Hu wrote: > From: Yue Hu <huyue2@coolpad.com> > > We only expand the trailing edge and not the leading edge. So no need > to obtain new start again. Let's use the existing ->headoffset instead. > > Signed-off-by: Yue Hu <huyue2@coolpad.com> > --- > fs/erofs/zdata.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c > index 874fee35af32..bab8dcb8e848 100644 > --- a/fs/erofs/zdata.c > +++ b/fs/erofs/zdata.c > @@ -1828,26 +1828,24 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, > { > struct inode *inode = f->inode; > struct erofs_map_blocks *map = &f->map; > - erofs_off_t cur, end; > + erofs_off_t cur, end, headoffset = f->headoffset; That is not quite useful, or could you merge this info the original patch? Thanks, Gao Xiang > int err; > > if (backmost) { > if (rac) > - end = f->headoffset + readahead_length(rac) - 1; > + end = headoffset + readahead_length(rac) - 1; > else > - end = f->headoffset + PAGE_SIZE - 1; > + end = headoffset + PAGE_SIZE - 1; > map->m_la = end; > err = z_erofs_map_blocks_iter(inode, map, > EROFS_GET_BLOCKS_READMORE); > if (err) > return; > > - /* expend ra for the trailing edge if readahead */ > + /* expand ra for the trailing edge if readahead */ > if (rac) { > - loff_t newstart = readahead_pos(rac); > - > cur = round_up(map->m_la + map->m_llen, PAGE_SIZE); > - readahead_expand(rac, newstart, cur - newstart); > + readahead_expand(rac, headoffset, cur - headoffset); > return; > } > end = round_up(end, PAGE_SIZE);
On Thu, 25 May 2023 13:56:14 +0800 Gao Xiang <hsiangkao@linux.alibaba.com> wrote: > On 2023/5/25 22:51, Yue Hu wrote: > > From: Yue Hu <huyue2@coolpad.com> > > > > We only expand the trailing edge and not the leading edge. So no need > > to obtain new start again. Let's use the existing ->headoffset instead. > > > > Signed-off-by: Yue Hu <huyue2@coolpad.com> > > --- > > fs/erofs/zdata.c | 12 +++++------- > > 1 file changed, 5 insertions(+), 7 deletions(-) > > > > diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c > > index 874fee35af32..bab8dcb8e848 100644 > > --- a/fs/erofs/zdata.c > > +++ b/fs/erofs/zdata.c > > @@ -1828,26 +1828,24 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, > > { > > struct inode *inode = f->inode; > > struct erofs_map_blocks *map = &f->map; > > - erofs_off_t cur, end; > > + erofs_off_t cur, end, headoffset = f->headoffset; > > > That is not quite useful, or could you merge this info the original patch? Okay, i will do the merge later. > > Thanks, > Gao Xiang > > > int err; > > > > if (backmost) { > > if (rac) > > - end = f->headoffset + readahead_length(rac) - 1; > > + end = headoffset + readahead_length(rac) - 1; > > else > > - end = f->headoffset + PAGE_SIZE - 1; > > + end = headoffset + PAGE_SIZE - 1; > > map->m_la = end; > > err = z_erofs_map_blocks_iter(inode, map, > > EROFS_GET_BLOCKS_READMORE); > > if (err) > > return; > > > > - /* expend ra for the trailing edge if readahead */ > > + /* expand ra for the trailing edge if readahead */ > > if (rac) { > > - loff_t newstart = readahead_pos(rac); > > - > > cur = round_up(map->m_la + map->m_llen, PAGE_SIZE); > > - readahead_expand(rac, newstart, cur - newstart); > > + readahead_expand(rac, headoffset, cur - headoffset); > > return; > > } > > end = round_up(end, PAGE_SIZE);
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 874fee35af32..bab8dcb8e848 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1828,26 +1828,24 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, { struct inode *inode = f->inode; struct erofs_map_blocks *map = &f->map; - erofs_off_t cur, end; + erofs_off_t cur, end, headoffset = f->headoffset; int err; if (backmost) { if (rac) - end = f->headoffset + readahead_length(rac) - 1; + end = headoffset + readahead_length(rac) - 1; else - end = f->headoffset + PAGE_SIZE - 1; + end = headoffset + PAGE_SIZE - 1; map->m_la = end; err = z_erofs_map_blocks_iter(inode, map, EROFS_GET_BLOCKS_READMORE); if (err) return; - /* expend ra for the trailing edge if readahead */ + /* expand ra for the trailing edge if readahead */ if (rac) { - loff_t newstart = readahead_pos(rac); - cur = round_up(map->m_la + map->m_llen, PAGE_SIZE); - readahead_expand(rac, newstart, cur - newstart); + readahead_expand(rac, headoffset, cur - headoffset); return; } end = round_up(end, PAGE_SIZE);