From patchwork Wed Dec 6 09:10:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Xiang X-Patchwork-Id: 174438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3979917vqy; Wed, 6 Dec 2023 01:11:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjTn0egFCOHYA7R62jpgDZB3SBpPnp7T58AoB6IVkNExFzmjhmVZS0Zgogi/KNLGlEctjM X-Received: by 2002:a05:6a20:9718:b0:18c:a983:a5f2 with SMTP id hr24-20020a056a20971800b0018ca983a5f2mr2677503pzc.29.1701853912560; Wed, 06 Dec 2023 01:11:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701853912; cv=none; d=google.com; s=arc-20160816; b=b9Tf5rNMJwvp870CnHU8etHBiROVuT3E/cYvNL9LUEdSi06tcEupX1+JVFr8c+JLfB 7m6fkL1zhMENDyRkxL/Ue0H+/qebfMmTtAdy5FSmQrH2DSErGaJAs7UFyHCb/edsp2h0 L+UKCOdxoFJwoxovFD60Xu/nFZgnvV09pyAgNf7thzNG1gyIUYM4PksYkh6AwuZQkUb3 ZG0+z83TrZtLp94d/8mfToD4A0qF0egQVKZ3ZBKhloLRycKxaBqO4MNFJ97aCa9qHoln V6fre35SzLHtnQBq3z8sLmmBXLtAHAy8kmxQm5eghnyxbHxusWdXosEFtgjMcUL9IC1p dnUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/2jYPTekw1W6D7L/JVr5i46RyE6KQCAu3qeeLMYekck=; fh=Z0R8B0AmUMsLcNxAwFR/TDJEQ3RBfXHfZWEZwiqrD84=; b=EcS8yEAqq/yv0ep80AKbim/TSNHGyhq9izB75jhHxN3xVNZwSYSevFzc6zNhU5VXs7 ylZUZz7VBPL4wTT4VSdvwzB/QJ9RaFJlg7rXLomPD6lHNYoANIX+os1w+R7IezHWNpKS cCZ/glU2oxgxdQY28WnUt9SgnFOoY3oxR08KPyNWTICBzSqpcaYMVnO9t7QTqrtHpL7M lK/TaURByAJdGG1l3/E3GH60T720zJ4TgKSH5RzXWhj7KPyEXWS/0g9BaKRJ1y7Focqr QCMl/s9NCI1GopZ7PtPc7UcmNH3Z9kthHXJ+F9g6QSjQrVacMSiNKYjrGCVmuNdd+CsQ Solg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s21-20020a63d055000000b005be3c09abf1si11067850pgi.397.2023.12.06.01.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 01:11:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 45C2C80FFDBB; Wed, 6 Dec 2023 01:11:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346831AbjLFJL2 (ORCPT + 99 others); Wed, 6 Dec 2023 04:11:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346777AbjLFJLN (ORCPT ); Wed, 6 Dec 2023 04:11:13 -0500 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D194F10C0 for ; Wed, 6 Dec 2023 01:11:18 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R291e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VxxSRQh_1701853876; Received: from e69b19392.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VxxSRQh_1701853876) by smtp.aliyun-inc.com; Wed, 06 Dec 2023 17:11:16 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , dhavale@google.com, Gao Xiang Subject: [PATCH 5/5] erofs: enable sub-page compressed block support Date: Wed, 6 Dec 2023 17:10:57 +0800 Message-Id: <20231206091057.87027-6-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231206091057.87027-1-hsiangkao@linux.alibaba.com> References: <20231206091057.87027-1-hsiangkao@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 01:11:50 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784523168174926630 X-GMAIL-MSGID: 1784523168174926630 Let's just disable cached decompression and inplace I/Os for partial pages as a first step in order to enable sub-page block initial support. In other words, currently it works primarily based on temporary short-lived pages. Don't expect too much in terms of performance. Signed-off-by: Gao Xiang --- fs/erofs/inode.c | 6 ++++-- fs/erofs/zdata.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 14a79d3226ab..3d616dea55dc 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -259,8 +259,10 @@ static int erofs_fill_inode(struct inode *inode) if (erofs_inode_is_data_compressed(vi->datalayout)) { #ifdef CONFIG_EROFS_FS_ZIP - if (!erofs_is_fscache_mode(inode->i_sb) && - inode->i_sb->s_blocksize_bits == PAGE_SHIFT) { + if (!erofs_is_fscache_mode(inode->i_sb)) { + DO_ONCE_LITE_IF(inode->i_sb->s_blocksize != PAGE_SIZE, + erofs_info, inode->i_sb, + "EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!"); inode->i_mapping->a_ops = &z_erofs_aops; err = 0; goto out_unlock; diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index d02989466711..a2c3e87d2f81 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -563,6 +563,8 @@ static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe) __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN; unsigned int i; + if (i_blocksize(fe->inode) != PAGE_SIZE) + return; if (fe->mode < Z_EROFS_PCLUSTER_FOLLOWED) return; @@ -967,12 +969,12 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, struct inode *const inode = fe->inode; struct erofs_map_blocks *const map = &fe->map; const loff_t offset = page_offset(page); + const unsigned int bs = i_blocksize(inode); bool tight = true, exclusive; unsigned int cur, end, len, split; int err = 0; z_erofs_onlinepage_init(page); - split = 0; end = PAGE_SIZE; repeat: @@ -1021,7 +1023,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, * for inplace I/O or bvpage (should be processed in a strict order.) */ tight &= (fe->mode > Z_EROFS_PCLUSTER_FOLLOWED_NOINPLACE); - exclusive = (!cur && ((split <= 1) || tight)); + exclusive = (!cur && ((split <= 1) || (tight && bs == PAGE_SIZE))); if (cur) tight &= (fe->mode >= Z_EROFS_PCLUSTER_FOLLOWED);