From patchwork Thu May 25 02:14:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Hu X-Patchwork-Id: 98746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp56982vqr; Wed, 24 May 2023 19:16:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+RLq5ZWC7+g/ht+0j2Pbvi8VdNfcRgi2gdCP9FUeuWJgKVJNlqCeVPpVV0W6iJX9QzSZC X-Received: by 2002:a05:6a20:c886:b0:106:5dff:5dc6 with SMTP id hb6-20020a056a20c88600b001065dff5dc6mr18431127pzb.16.1684980963434; Wed, 24 May 2023 19:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684980963; cv=none; d=google.com; s=arc-20160816; b=nJNWqxQsqq/1Jy1/MXU0+VwP+jZdhDOkaj1CSzGaqls9Pw8WZhDIqA4rrYdFzQ8yj1 6Fvu6fPj2/0raKmdyC1HItTN52bVR7k9giiU+ZxuJW0JyJ781CIuFSUauq4Zm/E5pEy/ JpcdGdW0DTYwJoJyqqt3qY4bRsAhR8N12VkReh2Q0Z6uZJSpRMp9TDcPv0POPMvcatN8 VXZwZtzuk9y/xTudUIJF3+5BE1qShc0otD/Wk8Wmnr6z7tFLModFKh2+HEiVkz+EsJiQ gt/itYMkusKWZti1Gd0C6H9DVj/gpmHP2aQxiEJP3zsUDI33q3ADZSRcBp9BwbQE2SBB Yd8w== 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=VzBlJLFAfyWSWb9nUXk9FvhTpGSd0CozzP+TkVxRg2s=; b=BRC+hJGF/517UNU6jyue7p5Du7A++cQc70upxySe2Ys3LLupUdOOKd6F4wg5TnIG9P oeu+2bPJpOiU8IPGSHGos3exLNvCXHt4ATzYxWt3+PfBgcZdz2H/qfkhny2qlsonNzVm grDO/mseNImNyuK/OQJojY+I7ZESD8M6K+TkQIZ5r6nyPe5riUuBdCS2KA4T0Bgu1ok9 jam2ANWiSGIwYQMn0XJglkNMy4/znWFxo8h1inqaBAhHPSbpswrBWAHTsrvTwqOR3iuF yk6Qk5c6I/aJVbR532WuaXQI94eSLWETNRQ2yT7fLQyFE4cfylso6XGCDU5G1Cbp/oeR mECg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DcGMR9DB; 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 k70-20020a638449000000b005347d73e09csi1908014pgd.837.2023.05.24.19.15.49; Wed, 24 May 2023 19: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=DcGMR9DB; 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 S229885AbjEYCPV (ORCPT + 99 others); Wed, 24 May 2023 22:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230250AbjEYCPT (ORCPT ); Wed, 24 May 2023 22:15:19 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46C0D1B1 for ; Wed, 24 May 2023 19:14:45 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-51b4ef5378bso925714a12.1 for ; Wed, 24 May 2023 19:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684980870; x=1687572870; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VzBlJLFAfyWSWb9nUXk9FvhTpGSd0CozzP+TkVxRg2s=; b=DcGMR9DBSVzrk5auQ81PVyyXqY8c/vFLnhHRdHPhhPmZz0vtzbwzTvIOJjrTT0zIKZ bG9JjhgNIS9oX2kG0Sa805UV4jYkp+MfUjb0VCp8XZAj+kQ7WKnOFOJI+bT++XPYQLtb +0sINuIAfwJhxEwF9LT/NBBRTEv4AejT+ozTzIijOSfml1JNZajVMKsCcowJg1JcxrSe m2IAOHXsiTAHzD6xiKvulAa0TbKcaYgArLYYZ5BDkiiSC2TSqiFVdZHxgZx/f8ZsBdu7 a7z8boqqtBLe8OQg1kV/5ze9dvsm7gtQAaKQbBeM1oC5X4mwe4ceKHPK6QacXs+LgxaP /UPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684980870; x=1687572870; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VzBlJLFAfyWSWb9nUXk9FvhTpGSd0CozzP+TkVxRg2s=; b=F63+NL/E6bnFeVcemPOs1sbJxFpPAN4YoOtfDL7CXY5rZLfh7Fs6gRQ7fjItEkHyUn neUV35MWs8HMCeYIMN0Ssi5IbptBdRqr8qe7WyXv3hVCtdmERET2UgZGY91+kdZ2C9NT H/h7fcFojbs+GF06IeGtYV5vwijnH5fxtyo6ylR6Epfbdt1rV6LniUMxUoBBXti04HjW knVKoNUxq61V6MlpZ4VT28QBkkZOxq9rvT/n55z9JXnPqoWnVRyBNii9++C83rjBIKQ5 LdrYXhbQG/ym5fA35sAqKcmbLH2JY4M3IhgaLKKy6lD3cV0L4mjnDinhUTrUIJXV2cdL ovgQ== X-Gm-Message-State: AC+VfDw42nyO0aMNlRRJCXDB/0cyyR2IgyGy4q7IFwtYy4kLy1ezIHT/ efXTKmLnzrKUxslHSx96Wiq2GTF41Wk= X-Received: by 2002:a17:90b:4b04:b0:253:5728:f631 with SMTP id lx4-20020a17090b4b0400b002535728f631mr19992pjb.15.1684980870426; Wed, 24 May 2023 19:14:30 -0700 (PDT) Received: from localhost.localdomain ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id t30-20020a63225e000000b0051afa49e07asm8419929pgm.50.2023.05.24.19.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 19:14:29 -0700 (PDT) From: Yue Hu 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 v2] erofs: remove end parameter from z_erofs_pcluster_readmore() Date: Thu, 25 May 2023 10:14:15 +0800 Message-Id: <20230525021415.8594-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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766830598977709579?= X-GMAIL-MSGID: =?utf-8?q?1766830598977709579?= From: Yue Hu The `end` argument is pointless if it's not backmost. And we already have `headoffset` in struct `*f`, so let's use this offset to get the `end` for backmost only instead in this function. Also, remove linux/prefetch.h that is not used anymore after commit 386292919c25 ("erofs: introduce readmore decompression strategy"). Signed-off-by: Yue Hu --- v2: - change to use if-else to obtain end value - minor commit message update fs/erofs/zdata.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 5cd971bcf95e..874fee35af32 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -5,7 +5,6 @@ * Copyright (C) 2022 Alibaba Cloud */ #include "compress.h" -#include #include #include #include @@ -1825,16 +1824,18 @@ static void z_erofs_runqueue(struct z_erofs_decompress_frontend *f, */ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, struct readahead_control *rac, - erofs_off_t end, - struct page **pagepool, - bool backmost) + struct page **pagepool, bool backmost) { struct inode *inode = f->inode; struct erofs_map_blocks *map = &f->map; - erofs_off_t cur; + erofs_off_t cur, end; int err; if (backmost) { + if (rac) + end = f->headoffset + readahead_length(rac) - 1; + else + end = f->headoffset + PAGE_SIZE - 1; map->m_la = end; err = z_erofs_map_blocks_iter(inode, map, EROFS_GET_BLOCKS_READMORE); @@ -1894,10 +1895,9 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio) trace_erofs_readpage(page, false); f.headoffset = (erofs_off_t)page->index << PAGE_SHIFT; - z_erofs_pcluster_readmore(&f, NULL, f.headoffset + PAGE_SIZE - 1, - &pagepool, true); + z_erofs_pcluster_readmore(&f, NULL, &pagepool, true); err = z_erofs_do_read_page(&f, page, &pagepool); - z_erofs_pcluster_readmore(&f, NULL, 0, &pagepool, false); + z_erofs_pcluster_readmore(&f, NULL, &pagepool, false); (void)z_erofs_collector_end(&f); @@ -1923,8 +1923,7 @@ static void z_erofs_readahead(struct readahead_control *rac) f.headoffset = readahead_pos(rac); - z_erofs_pcluster_readmore(&f, rac, f.headoffset + - readahead_length(rac) - 1, &pagepool, true); + z_erofs_pcluster_readmore(&f, rac, &pagepool, true); nr_pages = readahead_count(rac); trace_erofs_readpages(inode, readahead_index(rac), nr_pages, false); @@ -1947,7 +1946,7 @@ static void z_erofs_readahead(struct readahead_control *rac) page->index, EROFS_I(inode)->nid); put_page(page); } - z_erofs_pcluster_readmore(&f, rac, 0, &pagepool, false); + z_erofs_pcluster_readmore(&f, rac, &pagepool, false); (void)z_erofs_collector_end(&f); z_erofs_runqueue(&f, &pagepool,