Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1940299pxf; Fri, 26 Mar 2021 20:58:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+TucldtW8Syfs1sJej0iBi2egH/rblR2rvboVeght7WBBRFQ/qyyOgAPwHTKPtjyQiff3 X-Received: by 2002:a05:6402:40d5:: with SMTP id z21mr19005687edb.20.1616817516715; Fri, 26 Mar 2021 20:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616817516; cv=none; d=google.com; s=arc-20160816; b=rbNTG1HDlqyI7iA+uKDKzyWmY1AQfY+OSq79DgQElyPX7VTUwNv2ZKIy5qEBGKd3qY R41vxPxZ1TudStEwNyQznV8aWXk0+gt7cA23dutjZxKacf++6JqijBwqpnNyFXKO0HCG vdjHU0SzuNYwfIz94emRR5xhQYSiQF3zkEKirMgCEGAny2F37IiXsN9BWmbJj7+xdy5c AvFVcrEWQQ76FRmPwODHz1lU1YpSLrBc9WlRlKqzTztkt1vfnfu41qNqiOemehP2Jc/q 5GOY0HG0ktt6GIgjwJvSK7PbKl6sejsCPldUwDTFBtGb+J1Bn7zuUZsyiCyPS/RM9zYn Qyew== 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=mBsf4gRB163jzP3hqG+vznmpRskrdgmXc0mHVUpSVZg=; b=Xpc3a8IXz/xVT30AGzW2ZUm4T7+EB7M1CMEjJBXvrXMJ0rEjYR6ztM9mxya1fuF2Jd XIpiSHHiVpKgrZnbMMh30ZVPhXGHmf7P5/v0jvotICmSjuedm5II7fDzXD8h8uzEUhu8 CWXnsGW+vHRLRvO5t2t/J1CaldV6ALjVLQmjwNs4IuM1rFynyCsgB11oDs+ICB7COR6Z W6aHy0sPUTsn0LJIW7E/UdDfAcmTjUomVbTS+vzCH+b2/CUFvA0OXRRtoKh8j6G70DsF 2//LHy7QDHb8QYNLchMPOCwOfH3kdTh8RDwmPNXfT62rTXJBWxdibGROEQyTZ1cEb1Z3 OVXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aol.com header.s=a2048 header.b="Xru/UN0P"; 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=REJECT sp=REJECT dis=NONE) header.from=aol.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si1720370eds.331.2021.03.26.20.58.14; Fri, 26 Mar 2021 20:58:36 -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=@aol.com header.s=a2048 header.b="Xru/UN0P"; 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=REJECT sp=REJECT dis=NONE) header.from=aol.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231304AbhC0DuX (ORCPT + 99 others); Fri, 26 Mar 2021 23:50:23 -0400 Received: from sonic313-21.consmr.mail.gq1.yahoo.com ([98.137.65.84]:43332 "EHLO sonic313-21.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbhC0Dt4 (ORCPT ); Fri, 26 Mar 2021 23:49:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1616816995; bh=mBsf4gRB163jzP3hqG+vznmpRskrdgmXc0mHVUpSVZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=Xru/UN0Ph1TC593/cCb9Kv/k6XycBr+htM2xpmRalHrMPFp0mbvCjKQVh20I5tqYSEQPVGKVZBYgApySMMQyK0ozrycJPoJ7vBTSY2QPc7ciUN79dX5rG1BikuEyISWGzHNhFcJU12AptcFtbGyeM+d5SMR6CcI7K/DiRZatPK9e45l28a8l8KaQ0kXWtnZrpOjU+cMU9y+/KUc4/nImRw+uf3aVpKiGUTETZPyHWRTLjLoclsYdHK1hN4/fMAr+CtHimTHa9S8au74Zn8mHkk5IxqL1W7s0Qup7VKYmRaBY/SjLAbDzHNZEY2pRR1QaUfxZIzNRhajz6hU8C92l7g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1616816995; bh=Qp5fkRypCjNCWrK/2AQVdEDaHyGNiG/m0af4FZGc6ut=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=tdHowSmfwaiVhp5Kinnp+mAVviIWNjzXLJfaG/BrAtwQxbxjKQm0x0S3ByDgH8MuO1K3OMHZE3Ta4wn5OrZT5NR7y2IY+aMbGu0Jd2+U/UxxtYcQVmONWE4g6gO+KgaAXYDQGKpJlljBsZ8AP60fwWZF7eQ/92I9+DMFcADbce2wCc8X8caivn14gd3e+aIIf+i3Mrb28g7hF6WQaerYXYI4oEmhcc4FQyobJMwVVcxuRp5N0tkxJnfH3S2MA250EzbOju28XvJL2lHYR3X3yn//Bav4FNywARppz/cFnGaJRtQq8aCTo+aSQUM/RWsDZMTgRlUtIuFiK19gHvVBAg== X-YMail-OSG: ker.ajgVM1kfS40rafrrRXLTelQctl16Mm1hcdEZkKOYt5OgFDjF65aw40R633_ Y2oFgAs6th12RTbQ.zQZQsnDfeoPaIGc4iGIk7WDTdw9ofnFd5PRZBC6SCC_n.mZTpBxolX8l6Ct eEHGmIokAEK2YsDLVKv4lUKmSWnMGvgFeDoEAb2PbelB9PnuflEl3omjZXwSBs7AiqMfNWW5Grrs _ShGkpI0A73ujgYxMGAfJnRgrgnMUSPONj0KD0zG76orye0ARwODaahI85hG0_IaaCyWYTqepUGa c1lWEPkBetiiHEs3mcWOndqB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KPdshmy1I4M.CFFervYgwWzNbRAT.mCsOVap9SExBwp8N3TlnTR cRatczrnkpG8scA1cFHQMoBR6rzP4qCEFXmGouWtOpZi73TKtdhA4P4Z_lW5MHBRw0k_eFFKTfZP bO3e_qEJvxL6itKCjQkl_DQu9509.vewoZQJJOMzI46sC_yUivVs8heofr9ckF88mAz9V8mpvCGf mQ8PhNjZcZugcmNw6iEFTXjWyd77h51c- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Sat, 27 Mar 2021 03:49:55 +0000 Received: by kubenode529.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID b79f63fb2a60f2e9a0e41858735ab882; Sat, 27 Mar 2021 03:49:53 +0000 (UTC) From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu , Chao Yu Cc: LKML , Gao Xiang Subject: [PATCH 1/4] erofs: introduce erofs_sb_has_xxx() helpers Date: Sat, 27 Mar 2021 11:49:33 +0800 Message-Id: <20210327034936.12537-2-hsiangkao@aol.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210327034936.12537-1-hsiangkao@aol.com> References: <20210327034936.12537-1-hsiangkao@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Length: 2124 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gao Xiang Introduce erofs_sb_has_xxx() to make long checks short, especially for later big pcluster & LZMA features. Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 3 +-- fs/erofs/internal.h | 9 +++++++++ fs/erofs/super.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index 34e73ff76f89..80e8871aef71 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -124,8 +124,7 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out) support_0padding = false; /* decompression inplace is only safe when 0padding is enabled */ - if (EROFS_SB(rq->sb)->feature_incompat & - EROFS_FEATURE_INCOMPAT_LZ4_0PADDING) { + if (erofs_sb_has_lz4_0padding(EROFS_SB(rq->sb))) { support_0padding = true; while (!src[inputmargin & ~PAGE_MASK]) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 30e63b73a675..d29fc0c56032 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -218,6 +218,15 @@ static inline erofs_off_t iloc(struct erofs_sb_info *sbi, erofs_nid_t nid) return blknr_to_addr(sbi->meta_blkaddr) + (nid << sbi->islotbits); } +#define EROFS_FEATURE_FUNCS(name, compat, feature) \ +static inline bool erofs_sb_has_##name(struct erofs_sb_info *sbi) \ +{ \ + return sbi->feature_##compat & EROFS_FEATURE_##feature; \ +} + +EROFS_FEATURE_FUNCS(lz4_0padding, incompat, INCOMPAT_LZ4_0PADDING) +EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM) + /* atomic flag definitions */ #define EROFS_I_EA_INITED_BIT 0 #define EROFS_I_Z_INITED_BIT 1 diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 0445d09b6331..991b99eaf22a 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -149,7 +149,7 @@ static int erofs_read_superblock(struct super_block *sb) } sbi->feature_compat = le32_to_cpu(dsb->feature_compat); - if (sbi->feature_compat & EROFS_FEATURE_COMPAT_SB_CHKSUM) { + if (erofs_sb_has_sb_chksum(sbi)) { ret = erofs_superblock_csum_verify(sb, data); if (ret) goto out; -- 2.20.1