Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3250059pxf; Sun, 28 Mar 2021 18:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqxRfuK/VCSUTkqXvxFQpTyuFhw01W74PAY3FrSwsdPQNztQVfkxUgrHIormgJYbVRlNp3 X-Received: by 2002:a05:6402:31a7:: with SMTP id dj7mr26569039edb.33.1616981090837; Sun, 28 Mar 2021 18:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616981090; cv=none; d=google.com; s=arc-20160816; b=ecsB9aCLGAZVHC53Sm3v6G/kB+UZdfrk580saIlWxLKmPcZEsRyl2zhbq3PmJflvLz Ws4rjTkcelB4jazphkYubfsmgPYgWMSfD2WxLfft0LwOOFth6EzcmBDQVbqOoLCOycWa wBAbQF99dwsr/kxdPxpjBy3270fkbZGfSZ6wleQ0Xtuk5EFlgKoin/Kj2eF1etZpLlRX Op9QjXQzF1OBJsJyWEUXYzoZi2FwxM0IaH71mAGlQdSuo4UqNtQjSNCwX/+9dtprhEu8 psn/Vb40sgKeN32/Az8DXD1VmLfIS0LNI7JgiUXtHjgXfQ/E6dMqSgrMUvjcdHNvb3yW GoGA== 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=lbdPCd1M7K4gCTK9b66cSm+R762Vik52PQj05uWhct0=; b=Dlxodkvu96XeEy8LoupyZBSj4AuE5Hdgko47oDx/5Xxkde3BeoLUb/3nefzsdE1iZq fPeeipK3lUsQJ/17mk79WhFOafjQ+lw52XcZbakNT/80PLvoEry6cTkcBtZm+HHBi3et yV21V3+XthK+P0bpMbwhyYVAf1EVhr3aOcm4jJeyD+5MbeXMNz4bsapTZZuXKm3OnwFK ppn8wzWpjn/mLt7LLxWnG5tF7Tqb4/ntacXUqE8T+ha4jRtm4+qW4Cze9eRjhlmJbixw rt2as2g8aDTG0zbezwD/4bPuBIdA6fkN/abChQAsImVbJpM6oSP2DNSDEVpXlcad3NBR dXSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aol.com header.s=a2048 header.b=jEmpxTLy; 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 z31si12653135ede.226.2021.03.28.18.24.28; Sun, 28 Mar 2021 18:24:50 -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=jEmpxTLy; 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 S231314AbhC2BXg (ORCPT + 99 others); Sun, 28 Mar 2021 21:23:36 -0400 Received: from sonic317-21.consmr.mail.gq1.yahoo.com ([98.137.66.147]:44844 "EHLO sonic317-21.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbhC2BXX (ORCPT ); Sun, 28 Mar 2021 21:23:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1616981002; bh=lbdPCd1M7K4gCTK9b66cSm+R762Vik52PQj05uWhct0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=jEmpxTLyr/yu9qBiUmGm209Mni6r4QcXMuuKP5rjoX85g8VE0+ZPmdEKVa4YfqGjwSqamOMjgRHwRhgRbzQa3/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GiiYRATPCjGacrpcpJlMhOL6FpoVzSn5rrg.Mpx _WCpfU9Ey4dMCdhg_Ntnm2WRO8km7jphr_uf.Gm.I69JVf_c9nQ2pfV5WRNiC.qpzjjsPnCk4Mgk 1.w0K15IBqk7kokS7pKU7qMIIThq2iMtvOINv0P41mzBcMrEzMmVKw06y22WnDJukjTyo.guAnZL jqO51OUjf8kuotueCxQGam26PYIE7iXJaigjPmyKY2X7vfVl3Nz5BCddGhVAS2Cr3f4qevkeDrl7 WsyFb.5UASLVsca1hVA-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Mon, 29 Mar 2021 01:23:22 +0000 Received: by kubenode575.mail-prod1.omega.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 3d9d64f8790c67205a0f6cb47abdabe6; Mon, 29 Mar 2021 01:23:20 +0000 (UTC) From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu , Chao Yu Cc: LKML , Gao Xiang Subject: [PATCH v2 1/4] erofs: introduce erofs_sb_has_xxx() helpers Date: Mon, 29 Mar 2021 09:23:05 +0800 Message-Id: <20210329012308.28743-2-hsiangkao@aol.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210329012308.28743-1-hsiangkao@aol.com> References: <20210329012308.28743-1-hsiangkao@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Length: 2166 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. Reviewed-by: Chao Yu 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