Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp170272pxf; Wed, 31 Mar 2021 20:35:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPlqvJTKxOFDtsXh7NFENPFDTPMvATbPwZoqRoD3SpNh04vAfpsitsGzZYfveC1lCtwvWs X-Received: by 2002:aa7:dd4d:: with SMTP id o13mr7673850edw.53.1617248123895; Wed, 31 Mar 2021 20:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617248123; cv=none; d=google.com; s=arc-20160816; b=t/1kiiz2SW+YNL1BYdnCRJJ00VjeR9lz7fvhO2cw0KGOl6rqn2b6fMUuz+n81K4vOU XUMjG6GzgLISmLfeaDgDobWZn60hqbRLyGOgCQ4PJJAaP+o0e3xwOgAHjnAoOfFNzZkq psJxgMHp8c0PKTsglmlUq+bkbEL2UqOscNEJ8/iRlbEsVyCQRUi5wcnXKmArcmaqWD/2 CQ6n9Fe4vPDpxMeSPRf/JK8ChiL7lLutcUV+2kbYoQaJMrsSU/CSDx14zw1V0EEPEafp 3Kemi28tfvuBbFmllb2mPC/BTUjlQ9pJIKMr+ufEPjA5gPPtGs1xyaPyGhI7/gIa6BmI SixQ== 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 :dkim-signature; bh=gzYcWrHtRxdE8ZqdYpq1X5dS1QL+TjFRmwlzrldh0Ng=; b=CDe2xhSaFTqRlyQtE00qFtvlx92JhGk/w4usL27Pyi9lufhZQEKH+54Z0RPa6jYQeL cQTkEr8nXAQElaeqWv05COA/QXY/WfG34I4TnPXlPYwwJzpWp7TtbOi9cWVMMbPsgRMi dpywwEH3l5HjSThRispVKKzOBLSVdjak7SMcbL35qloLhIBwutc3xyfZCSr6XglNheNW LOloHzm5Joxe39+55FflONRFqfkszKeQuQtYgASfABZTy22kpx8Ck1Kfl1s5hilZqdye LK6fWKlG1PbGplF45VSA4QXPZ5I3TMhnVO+kybWbvjxH+grjn+PVqKHxCkoGCXY4B2r9 iimg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VVWs+e23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si3054933ejh.95.2021.03.31.20.35.01; Wed, 31 Mar 2021 20:35:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VVWs+e23; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233374AbhDADaM (ORCPT + 99 others); Wed, 31 Mar 2021 23:30:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:37618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233351AbhDADaC (ORCPT ); Wed, 31 Mar 2021 23:30:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4894960FE8; Thu, 1 Apr 2021 03:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617247801; bh=Zet8Tm3N3uiZMBlSsOQQx1HmGHuxiMEJLG2i+ggysv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VVWs+e23LTSrQU2JYGYrd5SCShIAzQNbVjdUymAb+YNg1WwOq1tan6FLACYIQYpHf LCNzJCyfWus+9Xy6x3elmJ5CjOYi1z0atMbSkul2Mmm5qs3pWQWwjUf0lngi6UfLAj zpTV34eCes8EqEG2NDqUC0EqKKE/Ief9bLyf9ysDDNyUyndOrZYUuKV4XOoPBhNSua 7XE5dTtELqInQQY3uec6kwtFb8yj58CsSNi6qFaYQxQgfXPq5ACd5OLXZ5A2PHp/QA OGiB3Xia3Z9CL11zXpM+US7EXLhJMo3o7w4xV40V1SKBAT0G6lzNyH4dGsog61gakL JRqFsicyyaQag== From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu , Chao Yu Cc: LKML , Gao Xiang Subject: [PATCH v2 01/10] erofs: reserve physical_clusterbits[] Date: Thu, 1 Apr 2021 11:29:45 +0800 Message-Id: <20210401032954.20555-2-xiang@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210401032954.20555-1-xiang@kernel.org> References: <20210401032954.20555-1-xiang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gao Xiang Formal big pcluster design is actually more powerful / flexable than the previous thought whose pclustersize was fixed as power-of-2 blocks, which was obviously inefficient and space-wasting. Instead, pclustersize can now be set independently for each pcluster, so various pcluster sizes can also be used together in one file if mkfs wants (for example, according to data type and/or compression ratio). Let's get rid of previous physical_clusterbits[] setting (also notice that corresponding on-disk fields are still 0 for now). Therefore, head1/2 can be used for at most 2 different algorithms in one file and again pclustersize is now independent of these. Signed-off-by: Gao Xiang --- fs/erofs/erofs_fs.h | 4 +--- fs/erofs/internal.h | 1 - fs/erofs/zdata.c | 3 +-- fs/erofs/zmap.c | 15 --------------- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h index 17bc0b5f117d..626b7d3e9ab7 100644 --- a/fs/erofs/erofs_fs.h +++ b/fs/erofs/erofs_fs.h @@ -233,9 +233,7 @@ struct z_erofs_map_header { __u8 h_algorithmtype; /* * bit 0-2 : logical cluster bits - 12, e.g. 0 for 4096; - * bit 3-4 : (physical - logical) cluster bits of head 1: - * For example, if logical clustersize = 4096, 1 for 8192. - * bit 5-7 : (physical - logical) cluster bits of head 2. + * bit 3-7 : reserved. */ __u8 h_clusterbits; }; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 60063bbbb91a..05b02f99324c 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -266,7 +266,6 @@ struct erofs_inode { unsigned short z_advise; unsigned char z_algorithmtype[2]; unsigned char z_logical_clusterbits; - unsigned char z_physical_clusterbits[2]; }; #endif /* CONFIG_EROFS_FS_ZIP */ }; diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index cd9b76216925..eabfd8873e12 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -430,8 +430,7 @@ static int z_erofs_register_collection(struct z_erofs_collector *clt, else pcl->algorithmformat = Z_EROFS_COMPRESSION_SHIFTED; - pcl->clusterbits = EROFS_I(inode)->z_physical_clusterbits[0]; - pcl->clusterbits -= PAGE_SHIFT; + pcl->clusterbits = 0; /* new pclusters should be claimed as type 1, primary and followed */ pcl->next = clt->owned_head; diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index 14d2de35110c..bd7e10c2fdd3 100644 --- a/fs/erofs/zmap.c +++ b/fs/erofs/zmap.c @@ -17,11 +17,8 @@ int z_erofs_fill_inode(struct inode *inode) vi->z_algorithmtype[0] = 0; vi->z_algorithmtype[1] = 0; vi->z_logical_clusterbits = LOG_BLOCK_SIZE; - vi->z_physical_clusterbits[0] = vi->z_logical_clusterbits; - vi->z_physical_clusterbits[1] = vi->z_logical_clusterbits; set_bit(EROFS_I_Z_INITED_BIT, &vi->flags); } - inode->i_mapping->a_ops = &z_erofs_aops; return 0; } @@ -77,18 +74,6 @@ static int z_erofs_fill_inode_lazy(struct inode *inode) } vi->z_logical_clusterbits = LOG_BLOCK_SIZE + (h->h_clusterbits & 7); - vi->z_physical_clusterbits[0] = vi->z_logical_clusterbits + - ((h->h_clusterbits >> 3) & 3); - - if (vi->z_physical_clusterbits[0] != LOG_BLOCK_SIZE) { - erofs_err(sb, "unsupported physical clusterbits %u for nid %llu, please upgrade kernel", - vi->z_physical_clusterbits[0], vi->nid); - err = -EOPNOTSUPP; - goto unmap_done; - } - - vi->z_physical_clusterbits[1] = vi->z_logical_clusterbits + - ((h->h_clusterbits >> 5) & 7); /* paired with smp_mb() at the beginning of the function */ smp_mb(); set_bit(EROFS_I_Z_INITED_BIT, &vi->flags); -- 2.20.1