From patchwork Wed Apr 26 04:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Hu X-Patchwork-Id: 87601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp136178rwl; Tue, 25 Apr 2023 21:56:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ755NamRilxlbEhgAnYjFyTIhBVc+ClFL/5DdG2aF90xq0x9q6elN6kG0GvE9pOqhPPUw3W X-Received: by 2002:a17:90a:8b83:b0:246:7582:b76f with SMTP id z3-20020a17090a8b8300b002467582b76fmr1630798pjn.0.1682485003573; Tue, 25 Apr 2023 21:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682485003; cv=none; d=google.com; s=arc-20160816; b=ZlTppQEjowBujKFwhsTuHACXRWoavQHBvkuUUsJYbcUeO8kl5UGNxECuJcTMV8G4Wk arsRMeKrNSvjZVWnb8TkALBgJe5wlu/uiEA/G5Rx3w7vqRNHJO3wS2N0O5C6f76+6aHK WLCbR4tCcpQuknIakExhwll074osCgfdiqaPkIUF6X27yBD3Zny2iaw8Win97Yqgif3d yWtkBGpTzGCOt+owcd1tIBJ10LoVFJtnXaAEalM2qmdnM4Oov+alZBJp9YWYG0QrrNny VHuZmCf8o2aV93EOK4jUYwHZAd3wkg+NiXX11vcq1CT0kKVlqdWhqxkJ7KeHWaHcPn3S ESrw== 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=colsF3QIXsTiooOemlNXQSPda56nkWMKGesQwoq3aEs=; b=spV2QM24tiwsbWXXXteOEwQPBmrPCm8+A4PDmWNeTxSP09n25dfzBMvdzqrfqnxDeY gC6UKbcIYj9RF3ofLH/NwBXNlvCRsI2Zi+Xw590MRPZ73BSaQkc0BgVVjJiHs9tHmHTT /4uzMH4bbu/0Tu5r3bUTQfmcbizm2r1ikEnePByfJMyNtWra9x9psJsjp+T0AmvnMpdR l7q16A47Rt7h5sQmGhenyGkqok+DOdE5no2xsHftsUgKVr/cGNh0R5GlkzvwfjPF63pg 0HM8Au2dIyYKpkmZMgeB5aMeeg4P7vLjeCE8JQ6ev8vbDip0ZkFK9yo7gBi2UmBDRRvn VAEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mazw8iLR; 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 h9-20020a17090acf0900b002467e72af54si15350749pju.43.2023.04.25.21.56.31; Tue, 25 Apr 2023 21:56:43 -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=mazw8iLR; 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 S239355AbjDZEM3 (ORCPT + 99 others); Wed, 26 Apr 2023 00:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239023AbjDZEM1 (ORCPT ); Wed, 26 Apr 2023 00:12:27 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E9A1990 for ; Tue, 25 Apr 2023 21:12:26 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-63d4595d60fso40297817b3a.0 for ; Tue, 25 Apr 2023 21:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682482345; x=1685074345; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=colsF3QIXsTiooOemlNXQSPda56nkWMKGesQwoq3aEs=; b=mazw8iLRHJGZBQdTJyeMGzuvsIwR4uLQ33MCJ/K5e343t+/FHOL+GrfZhglheX+uqg nbKyPWCtuqGV3Vx00K/tF/QYlYHmaGznzQ3ypUHqvk05C6aPqX8PDCofm1mu8j/tzVnl /Im8COJ9vjtanht5dTS7i8++Z0tHPkMx5hR5a00sFWHctVsl/khPGC3KeldHXIJo0r1s A8jaIKazTg5TYsMVRUUJvB6Gm26PFcBrjC0bGECphRSqNitASGu0y4FFGkAl3zURjDTt FqLcxk5aMko+CQcVb/aQNNUURHqU3DB6TrAo6/U0o14clg0mi7ybbo3KKHNk6fNgNzvK xpIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682482345; x=1685074345; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=colsF3QIXsTiooOemlNXQSPda56nkWMKGesQwoq3aEs=; b=gWDFPC5ZdpczpL6vr8n8fCsdDCOW7QqYcJZvBBhSUo4yNyJnbM7DiwNDbNvSkxLRbj I7a0xpkf+UYFTbjBFoTv7xLUxssPCPN6+j9GMuqohKGjsrRmJvMfU9KdOWYYkRnQTTOw u3YBjx42JpuGRYbRmlfAqK5SW3wXr+cbNg1vftj68amuJ83icZaat/eHEg9/t21L4/Go 5NoyVKeZj6YQIqUlrA+YAch/FZJPQ0KbX4JfxXW2KL7Oe7Gw2ZHLjbhD6kuh/DBmUtFn fQ6sj8UBX2s3A2KBexInrvFmvHX9uIOHzks+yaErTRFGNSOIEdo4AGkhUHebGzMxcDYq V+ng== X-Gm-Message-State: AC+VfDzwGVXXWlRD0sAyCCqlvO6d6ZrVe0hMXqZP5Drv7nbfVGcypnne 6altzlp9UBxw+abt591hAyGz5gMfiMg= X-Received: by 2002:a17:903:445:b0:1a9:7bf4:17d8 with SMTP id iw5-20020a170903044500b001a97bf417d8mr1216085plb.18.1682482345344; Tue, 25 Apr 2023 21:12:25 -0700 (PDT) Received: from localhost.localdomain ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id t5-20020a170902bc4500b001a68d613ad9sm8983193plz.132.2023.04.25.21.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 21:12:24 -0700 (PDT) From: Yue Hu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: jefflexu@linux.alibaba.com, huyue2@coolpad.com, linux-kernel@vger.kernel.org, zhangwen@coolpad.com Subject: [PATCH 1/2] erofs: get rid of name from struct z_erofs_decompressor Date: Wed, 26 Apr 2023 12:10:26 +0800 Message-Id: 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?1764213395189002445?= X-GMAIL-MSGID: =?utf-8?q?1764213395189002445?= From: Yue Hu There are no users of the name and we can get this via ->alg if needed. Also, move struct z_erofs_decompressor into decompressor.c which is the only one to use it. Signed-off-by: Yue Hu --- fs/erofs/compress.h | 6 ------ fs/erofs/decompressor.c | 9 +++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/erofs/compress.h b/fs/erofs/compress.h index 26fa170090b8..d161683bda03 100644 --- a/fs/erofs/compress.h +++ b/fs/erofs/compress.h @@ -20,12 +20,6 @@ struct z_erofs_decompress_req { bool inplace_io, partial_decoding, fillgaps; }; -struct z_erofs_decompressor { - int (*decompress)(struct z_erofs_decompress_req *rq, - struct page **pagepool); - char *name; -}; - /* some special page->private (unsigned long, see below) */ #define Z_EROFS_SHORTLIVED_PAGE (-1UL << 2) #define Z_EROFS_PREALLOCATED_PAGE (-2UL << 2) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 7021e2cf6146..f416ebd6f0dc 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -363,23 +363,24 @@ static int z_erofs_transform_plain(struct z_erofs_decompress_req *rq, return 0; } +struct z_erofs_decompressor { + int (*decompress)(struct z_erofs_decompress_req *rq, + struct page **pagepool); +}; + static struct z_erofs_decompressor decompressors[] = { [Z_EROFS_COMPRESSION_SHIFTED] = { .decompress = z_erofs_transform_plain, - .name = "shifted" }, [Z_EROFS_COMPRESSION_INTERLACED] = { .decompress = z_erofs_transform_plain, - .name = "interlaced" }, [Z_EROFS_COMPRESSION_LZ4] = { .decompress = z_erofs_lz4_decompress, - .name = "lz4" }, #ifdef CONFIG_EROFS_FS_ZIP_LZMA [Z_EROFS_COMPRESSION_LZMA] = { .decompress = z_erofs_lzma_decompress, - .name = "lzma" }, #endif }; From patchwork Wed Apr 26 04:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Hu X-Patchwork-Id: 87602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp136994rwl; Tue, 25 Apr 2023 21:59:07 -0700 (PDT) X-Google-Smtp-Source: AKy350YYkAKZyon09o793xsaeRlg/EJ0RoBrkD/0U++IQEVu1xjZdjXYpDa6ks8xhLUx4qRUWVs3 X-Received: by 2002:a05:6a00:2d88:b0:63d:2d99:2e7c with SMTP id fb8-20020a056a002d8800b0063d2d992e7cmr27596885pfb.0.1682485147404; Tue, 25 Apr 2023 21:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682485147; cv=none; d=google.com; s=arc-20160816; b=kAtOQOW8C0Fsoy+ZI8HJ9HKY6x3WGIzgfNBc4xi0+eaK9iNsDHT4dluuLbr2BNNset HM6NoWKK61UbYKWdp239utwe+10UlEdlg3EWwKc1EMLzpEsxOJXe3KsSWJGCu3M+9L2k EhWP8xiDh612BBQrjOiWrIQfdRdqiW7PlLIwPsAmRvl0R9/Gft0mFvGyPwLJHptN3Krl poE+H27LLxlMoX+QYkOFsLNuJ29VuTdr8Yu/WaHlSptzRzAK7/WGPUZLc8lA0paOB1bf +eLxpBiiL9sYbThA87segnRvkp834ImStHZj0/YU37gC8kRAph2li/tL23J9PMWZg1lD 88hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=X1WEqmaMBFmHP4p7ngRgW+kux9X7VvJXBfEqvQ44Wow=; b=Jc9964XtoK46v0oPax7B6/57x/cbtVCs2ocfdFitTLqZYKX14dg8qbmNUnPrH4zYJ9 wGnlBwNbefDQV2aerAiF2rMqjcogl2vmpZb7DR9G9D94k7ivp1jmx+VtWkTJIrE+lzNs ZPKy2pYyIBPtfWHduVxMisHCdlLpUqyYVPTAqUk0Q/3XLiCbDoyAZMzoNoMjGpXpyoTb smnGUs7MJ+y6C3IiuqY5h4A93cScnUgPgvUdPjs8iqi8AFJVKXceWVkJ4U1yvnyARoz+ ATPVE+XjOldKFpWb1+6P7wQyBUkz+bBqrZyXRNQ1y22BZhTXWBVvDyaHTztJRR+Ih+n2 mkRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=FkNan6se; 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 4-20020a620604000000b0063b72bd28absi2381552pfg.135.2023.04.25.21.58.52; Tue, 25 Apr 2023 21:59:07 -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=FkNan6se; 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 S239384AbjDZEMi (ORCPT + 99 others); Wed, 26 Apr 2023 00:12:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239378AbjDZEMg (ORCPT ); Wed, 26 Apr 2023 00:12:36 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23FB826B9 for ; Tue, 25 Apr 2023 21:12:35 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-51f597c975fso6706707a12.0 for ; Tue, 25 Apr 2023 21:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682482354; x=1685074354; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=X1WEqmaMBFmHP4p7ngRgW+kux9X7VvJXBfEqvQ44Wow=; b=FkNan6seMjrCrf/+Y0Ne53q39DQC2hptzm8MXKt6vLlLuxLwlRNRrFs8YFuWKByRS5 M/sOGNSLfOa+fFffafOUQbpHFS0qET5gxIGdgyOdiEkYC6o3QcUFEZHP5lmslR1DqJr6 3cYklHnsd6GZ6g2uL9oLhcZV6gT1NXzKcDAMiuH5eZ0WL+xX/hAoyhxLBZBWACuQFCC5 G18s+WD22+5jJCyrORTFE0lIQhE0QNJ0M8avMMIU5aA8ET3uLmcegPdswv8wvy0RxAKP CAdzT/QLHCoAAtACqUg73dXNGlInjK7+wI2M99AS12hM4rJwpItoZNt7jPF9P9LlVnCO zSnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682482354; x=1685074354; h=references:in-reply-to: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=X1WEqmaMBFmHP4p7ngRgW+kux9X7VvJXBfEqvQ44Wow=; b=Do+SwR2I9LRoGpZ7wVI8q4HlewOJpiFKGEDuyqwkwmZ7O6NrQzDnhi/MAovWTf8R0w /wQf099jmL9lmEh/QQww+xxff/LErISn5n6p/JbioXw0WQ8xZci76Fboh9PWayi8eZZ9 Zn5EymKdB4uu9eTlmQSI7VsL1p9sZGaC382dMDRhzc8pX9rhqeTaEFD7ffpivLlthNlC KoW4oFhy+DbMvDLohNeIR4Kz0ihrIFJRBtaffx1I0z2kY9Ng55V614gWKv3FqBu9m1S4 bdReJjW7icCdnmSmQhT4QxUHdLw9Fdx4c1wfuB7WFXNbVQiGRL/fG7YCD5cExJYdO+D3 2Sfg== X-Gm-Message-State: AAQBX9fs4vHa6BBeEtkHo/DfRL1R7IwgzkwLErDxIVt5HqXblrXRjm6d bxe2VzrMLXZigKUuVIN5zQU= X-Received: by 2002:a17:902:dacc:b0:19e:ab29:1ec2 with SMTP id q12-20020a170902dacc00b0019eab291ec2mr26919278plx.65.1682482354637; Tue, 25 Apr 2023 21:12:34 -0700 (PDT) Received: from localhost.localdomain ([156.236.96.165]) by smtp.gmail.com with ESMTPSA id t5-20020a170902bc4500b001a68d613ad9sm8983193plz.132.2023.04.25.21.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 21:12:34 -0700 (PDT) From: Yue Hu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: jefflexu@linux.alibaba.com, huyue2@coolpad.com, linux-kernel@vger.kernel.org, zhangwen@coolpad.com Subject: [PATCH 2/2] erofs: replace global decompressors[] with stack memory Date: Wed, 26 Apr 2023 12:10:27 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: 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?1764213545679926198?= X-GMAIL-MSGID: =?utf-8?q?1764213545679926198?= From: Yue Hu Note that only z_erofs_decompress() is using the decompressors[], so no need to keep it as global resource, just use local one instead. Signed-off-by: Yue Hu --- fs/erofs/decompressor.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index f416ebd6f0dc..91d91bdd068f 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -368,25 +368,24 @@ struct z_erofs_decompressor { struct page **pagepool); }; -static struct z_erofs_decompressor decompressors[] = { - [Z_EROFS_COMPRESSION_SHIFTED] = { - .decompress = z_erofs_transform_plain, - }, - [Z_EROFS_COMPRESSION_INTERLACED] = { - .decompress = z_erofs_transform_plain, - }, - [Z_EROFS_COMPRESSION_LZ4] = { - .decompress = z_erofs_lz4_decompress, - }, -#ifdef CONFIG_EROFS_FS_ZIP_LZMA - [Z_EROFS_COMPRESSION_LZMA] = { - .decompress = z_erofs_lzma_decompress, - }, -#endif -}; - int z_erofs_decompress(struct z_erofs_decompress_req *rq, struct page **pagepool) { + struct z_erofs_decompressor decompressors[] = { + [Z_EROFS_COMPRESSION_SHIFTED] = { + .decompress = z_erofs_transform_plain, + }, + [Z_EROFS_COMPRESSION_INTERLACED] = { + .decompress = z_erofs_transform_plain, + }, + [Z_EROFS_COMPRESSION_LZ4] = { + .decompress = z_erofs_lz4_decompress, + }, +#ifdef CONFIG_EROFS_FS_ZIP_LZMA + [Z_EROFS_COMPRESSION_LZMA] = { + .decompress = z_erofs_lzma_decompress, + }, +#endif + }; return decompressors[rq->alg].decompress(rq, pagepool); }