From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33A36C43464 for ; Sat, 19 Sep 2020 07:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2C5B21582 for ; Sat, 19 Sep 2020 07:28:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T3aEMEC8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726293AbgISH2Z (ORCPT ); Sat, 19 Sep 2020 03:28:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57999 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgISH2Z (ORCPT ); Sat, 19 Sep 2020 03:28:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600500503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=xApC2kZG8EcnsErnZQz6jR2tMYwegUZKMG/mP3N+5Ys=; b=T3aEMEC8STkXWws2Ubo1qr8hxRVJbBgeMuxFB1TV6rUJot5TPnj08L+0HqMMU0OtXkS/2E E/pj2RUvh2o6WjLfeT/AoIuuDotYvqQT+E85lGAxJeLQ4+wUg9dy3aMnucW0PrTWBC19jL T9pjOYadB8okDWSv5k1kdmz8fgUenUs= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-481-4o6iXLOoNnepOJbOKgv7kQ-1; Sat, 19 Sep 2020 03:28:19 -0400 X-MC-Unique: 4o6iXLOoNnepOJbOKgv7kQ-1 Received: by mail-pl1-f199.google.com with SMTP id 93so4640606plc.13 for ; Sat, 19 Sep 2020 00:28:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xApC2kZG8EcnsErnZQz6jR2tMYwegUZKMG/mP3N+5Ys=; b=N+psUlqbviyEZmI35itx4IllsAW2gJWjWgeONajTcAECV7448KtlSEzhb38ZoARP2V XiBKzR28Lc0FPo2MpVSE0gGRFTVt885EVWuurDbSuO7gCUBvfWexgUqSlTjUZaGnyfLG Hc4PeoC+kVpGtMg1QYpyCVzmstsbYDtH29DCCKiWKYetJKH2uo4wkHqoeb3t3vM5cGh/ nrdE8vYy4bAMwetZRB+eSNwljyb+ZZ8nyzqhC/Mz+iPU/anQ03JhRYN2gd9YBbLoGIhR 8RVttQd4HdguuN1KxFFck+Y6h5u5sEI41pZxCuyDE7bNRif5LUBURDPk37jQFynO1Mgk UKDA== X-Gm-Message-State: AOAM530oQQ2Ix5X9r1Y3+4Cd27esDpiCfhZpdmGNVYHDsaJdTLZ0puaW UuBQ/e9fCj90t92fWECOanZyPt4Y5BKoVhnNhC0CC6uef2kN6BdokDidWIWU8BD+BreLGZ5W52Q IbAdTx6j9Rb4Di0/Fr8u2wrmP X-Received: by 2002:a17:902:b591:b029:d1:e598:740a with SMTP id a17-20020a170902b591b02900d1e598740amr18712750pls.61.1600500498737; Sat, 19 Sep 2020 00:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgH359QIQRd5hI5pfwvsaJgzRNMzTB3Y/mwN8BxuqR/YT5E+surSi5i6c5ZEg3h2BdrgyJRg== X-Received: by 2002:a17:902:b591:b029:d1:e598:740a with SMTP id a17-20020a170902b591b02900d1e598740amr18712739pls.61.1600500498497; Sat, 19 Sep 2020 00:28:18 -0700 (PDT) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id s3sm5407381pfe.116.2020.09.19.00.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2020 00:28:18 -0700 (PDT) From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: LKML , Chao Yu , Gao Xiang Subject: [PATCH v2 2/3] erofs: fold in should_decompress_synchronously() Date: Sat, 19 Sep 2020 15:27:29 +0800 Message-Id: <20200919072730.24989-2-hsiangkao@redhat.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20200919072730.24989-1-hsiangkao@redhat.com> References: <20200919072730.24989-1-hsiangkao@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org should_decompress_synchronously() has one single condition for now, so fold it instead. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- no change since v1. fs/erofs/zdata.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index e43684b23fdd..bee6ce783c64 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1294,24 +1294,18 @@ static int z_erofs_readpage(struct file *file, struct page *page) return err; } -static bool should_decompress_synchronously(struct erofs_sb_info *sbi, - unsigned int nr) -{ - return nr <= sbi->ctx.max_sync_decompress_pages; -} - static void z_erofs_readahead(struct readahead_control *rac) { struct inode *const inode = rac->mapping->host; struct erofs_sb_info *const sbi = EROFS_I_SB(inode); - bool sync = should_decompress_synchronously(sbi, readahead_count(rac)); + unsigned int nr_pages = readahead_count(rac); + bool sync = (nr_pages <= sbi->ctx.max_sync_decompress_pages); struct z_erofs_decompress_frontend f = DECOMPRESS_FRONTEND_INIT(inode); struct page *page, *head = NULL; LIST_HEAD(pagepool); - trace_erofs_readpages(inode, readahead_index(rac), - readahead_count(rac), false); + trace_erofs_readpages(inode, readahead_index(rac), nr_pages, false); f.headoffset = readahead_pos(rac); -- 2.18.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2CC0C43463 for ; Sat, 19 Sep 2020 07:28:40 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE44720DD4 for ; Sat, 19 Sep 2020 07:28:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DxInGp9D"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ibc2T1xt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE44720DD4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4Btj455ShNzDqmJ for ; Sat, 19 Sep 2020 17:28:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=216.205.24.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=hsiangkao@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DxInGp9D; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ibc2T1xt; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Btj3r2MKMzDqm6 for ; Sat, 19 Sep 2020 17:28:24 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600500501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=xApC2kZG8EcnsErnZQz6jR2tMYwegUZKMG/mP3N+5Ys=; b=DxInGp9DY+5t2HVQNOPadybzXfQCEggARNZFQvszQ3/Dmqe7LTJtAKz+1MSy8wHu+y5ack x2py9H2W4wL9uO/O3r/YBldgYPgNNEFd8+2/fkmrHWwpDhi+IaUN2aGhsKfUSTn7bIBsqJ K5vz+heeJT500bDej6eVudPd3CHfnOA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600500502; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=xApC2kZG8EcnsErnZQz6jR2tMYwegUZKMG/mP3N+5Ys=; b=Ibc2T1xtk+ho/OwAeZw0qPvMP6iTxR4fbNIf89SQe5G4jK77LHe7FT4ufj56A4fM395XSK 3Af9+FsYITWL5Hw45w0T2fHh0wv0Yq0dWJnJsYhnC3Zd337tlglNF5xqfLUAv4zJ+xLtuq 2yD2Ji60bsrRb2Lgfal6l/URPdLveuw= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-u_gbR8qbMTO2ICpgFP5fCQ-1; Sat, 19 Sep 2020 03:28:20 -0400 X-MC-Unique: u_gbR8qbMTO2ICpgFP5fCQ-1 Received: by mail-pf1-f199.google.com with SMTP id h15so5102759pfr.3 for ; Sat, 19 Sep 2020 00:28:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xApC2kZG8EcnsErnZQz6jR2tMYwegUZKMG/mP3N+5Ys=; b=hAvnrpZC3Q5MRC3ELSiJT71cM4UVBD7zau9noAxGNiuldXVUhOh+2DnRnFURu/AcFw DLD0ixuxnzSTtZSIhjMmJ+1wZLPR8Cy/TTBqUlUB854H2C7cwlYulA0NA4RnQ+qfR47W TdWWnxnRibdd03iKADrXDHG5F7UpratnlgzZdPwdTrKQMjnWa6OVCIi979cVO8jlKQq6 Xvc7uR2thdyvBjQhBBfoy6B9elgdvar8GxKW3uhpLfGuk2NDdrvqSNnkoY8nedhgF+4N CK01amHw0rRnKN7jc5bOVSYLAFanbIZU82nEpPpQOznnuk1cL5M4bIOK30K05NrKgOYo rNBw== X-Gm-Message-State: AOAM530cAzePEdwy858MD2Vt94oyEZo0Oxw3LuBYi+4xszAph1NKgjDi ACeHXO7O55wR/ssVvSqCZkR2Hmc4jUCIVSUbDgXqzDdUFS1X+KvHhdE9lQ3TAdyCo6V2U+uniLD I64RCosdtdmDwzPtAstWwfdPJ X-Received: by 2002:a17:902:b591:b029:d1:e598:740a with SMTP id a17-20020a170902b591b02900d1e598740amr18712751pls.61.1600500498737; Sat, 19 Sep 2020 00:28:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgH359QIQRd5hI5pfwvsaJgzRNMzTB3Y/mwN8BxuqR/YT5E+surSi5i6c5ZEg3h2BdrgyJRg== X-Received: by 2002:a17:902:b591:b029:d1:e598:740a with SMTP id a17-20020a170902b591b02900d1e598740amr18712739pls.61.1600500498497; Sat, 19 Sep 2020 00:28:18 -0700 (PDT) Received: from xiangao.remote.csb ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id s3sm5407381pfe.116.2020.09.19.00.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Sep 2020 00:28:18 -0700 (PDT) From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Subject: [PATCH v2 2/3] erofs: fold in should_decompress_synchronously() Date: Sat, 19 Sep 2020 15:27:29 +0800 Message-Id: <20200919072730.24989-2-hsiangkao@redhat.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20200919072730.24989-1-hsiangkao@redhat.com> References: <20200919072730.24989-1-hsiangkao@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=hsiangkao@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LKML Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" should_decompress_synchronously() has one single condition for now, so fold it instead. Reviewed-by: Chao Yu Signed-off-by: Gao Xiang --- no change since v1. fs/erofs/zdata.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index e43684b23fdd..bee6ce783c64 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1294,24 +1294,18 @@ static int z_erofs_readpage(struct file *file, struct page *page) return err; } -static bool should_decompress_synchronously(struct erofs_sb_info *sbi, - unsigned int nr) -{ - return nr <= sbi->ctx.max_sync_decompress_pages; -} - static void z_erofs_readahead(struct readahead_control *rac) { struct inode *const inode = rac->mapping->host; struct erofs_sb_info *const sbi = EROFS_I_SB(inode); - bool sync = should_decompress_synchronously(sbi, readahead_count(rac)); + unsigned int nr_pages = readahead_count(rac); + bool sync = (nr_pages <= sbi->ctx.max_sync_decompress_pages); struct z_erofs_decompress_frontend f = DECOMPRESS_FRONTEND_INIT(inode); struct page *page, *head = NULL; LIST_HEAD(pagepool); - trace_erofs_readpages(inode, readahead_index(rac), - readahead_count(rac), false); + trace_erofs_readpages(inode, readahead_index(rac), nr_pages, false); f.headoffset = readahead_pos(rac); -- 2.18.1