Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp747128imm; Wed, 18 Jul 2018 09:58:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdndRLWyRoeJaeEdsgzhMXIckqTi0DwUj1umaJtMn6khwO7ZAg1+bzbK2ccRZn2/MuAhhCk X-Received: by 2002:a63:c00b:: with SMTP id h11-v6mr6398939pgg.279.1531933115090; Wed, 18 Jul 2018 09:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531933115; cv=none; d=google.com; s=arc-20160816; b=htrNFd2NIdU14YN6iP/Zz9S+qhy6m6+pgpYpdki/kLHbHgHi+ycgwECXXUxUNds0/G c4Wl3oiTIdnCAfZEIep+eWQSU9UBH93dBTbwPgYO/+ZXrmwCf89u+VqFSpab8t4j2xw5 m7VMBcUHB8sVln0lits/tpUXk2+Gk2GnihVoC3VKEd2fhrIZHattcf1llW29E56Y1uwh p3BRvu1Jdg2oMqkYsgMvXcNLv/MRWEmiUtzSftBB/g+5dTeV6bzYGalReDoLoMmEPysD DekDgVCqZKx34kBTaA25wnVw0FVmiHvAvHfhzU0b2juhZHZ8WR0JdvA0nskHF2POA2Ac NaDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=oAdU3IqOlvw4tQWOirRafUQwln01zTS/YDZXu+ikrhg=; b=Zl767zwF3apKRmGWcPsZSe1dcnRTIF/wfZUWwlLadhPIKUaEC9Qw6htGJhEM/td+e2 ybehSX1SW9xfSaijZjXPaseu1BojqT3a2LesuPH1stC7E0olklOLVRtc2rBPCLVt8yPN 7FxYdSjzZWxrVvORoV03dOpbUnm6mD54J+Sqijzh8wiSYp7BVcUUalLsXPRQPvERb6O0 VJoIREyXtgpzlRHp+hNzJDEx31ZwaqhIqJesu1CgwqcJVO1d4dbPWOw0yAACcqyJ3IQz tHI5p/+BfcQGSEXmMacdsAKEPYJ62z5pav9ggHBkjurYa4c3tkQBFKE0S/gFtv5XYAzt vNag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si3458666pll.493.2018.07.18.09.57.57; Wed, 18 Jul 2018 09:58:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731549AbeGRRfF (ORCPT + 99 others); Wed, 18 Jul 2018 13:35:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:47730 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731351AbeGRRfF (ORCPT ); Wed, 18 Jul 2018 13:35:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 03C88ADEC; Wed, 18 Jul 2018 16:56:17 +0000 (UTC) From: Coly Li To: linux-kernel@vger.kernel.org Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, Coly Li , Andy Shevchenko , Greg Kroah-Hartman , Linus Torvalds , Thomas Gleixner , Michael Lyle , Kent Overstreet , Kate Stewart , Andrew Morton , Randy Dunlap Subject: [PATCH v4 0/3] add crc64 calculation as kernel library Date: Thu, 19 Jul 2018 00:55:42 +0800 Message-Id: <20180718165545.1622-1-colyli@suse.de> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set adds basic implementation of crc64 calculation as Linux kernel library. Since bcache already does crc64 by itself, this patch set also modifies bcache code to use the new crc64 library routine. Currently bcache is the only user of crc64 calculation, another potential user is bcachefs which is on the way to be in mainline kernel. Therefore it makes sense to make crc64 calculation to be a public library. bcache uses crc64 as storage checksum, if a change of crc lib routines results an inconsistent result, the unmatched checksum may make bcache 'think' the on-disk is corrupted, such change should be avoided or detected as early as possible. Therefore the last patch in this series adds a crc test framework, to check consistency of different calculations. Coly Li Cc: Andy Shevchenko Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Thomas Gleixner Cc: Michael Lyle Cc: Kent Overstreet Cc: Kate Stewart Cc: Andrew Morton Cc: Randy Dunlap --- Changelog: v4: Only keep crc64_be() in lib/crc64.c, tested bcache specific stuffs moved back to bcache code. Fixes all review comments of v3. v3: Remove little endian restriction and remove 'le' from function names. Fixes all review comments of v2 v2: Combine first two patches into one Fixes all review comments of v1 v1: Initial version. Coly Li (3): lib: add crc64 calculation routines bcache: use routines from lib/crc64.c for CRC64 calculation lib/test_crc: Add test cases for crc calculation drivers/md/bcache/Kconfig | 1 + drivers/md/bcache/util.c | 131 -------------------------------------- drivers/md/bcache/util.h | 21 ++++-- include/linux/crc64.h | 11 ++++ lib/.gitignore | 2 + lib/Kconfig | 8 +++ lib/Kconfig.debug | 10 +++ lib/Makefile | 12 ++++ lib/crc64.c | 56 ++++++++++++++++ lib/gen_crc64table.c | 68 ++++++++++++++++++++ lib/test_crc.c | 93 +++++++++++++++++++++++++++ 11 files changed, 278 insertions(+), 135 deletions(-) create mode 100644 include/linux/crc64.h create mode 100644 lib/crc64.c create mode 100644 lib/gen_crc64table.c create mode 100644 lib/test_crc.c -- 2.17.1