Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3185779imm; Mon, 16 Jul 2018 23:58:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpflbKJtiba/RJ9S/Ky/8S1E05M58OfCa6VuHYAsM5pqBSBOGwg0WNCh8WY315pdjYtrsBRw X-Received: by 2002:a62:d693:: with SMTP id a19-v6mr435193pfl.248.1531810693618; Mon, 16 Jul 2018 23:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531810693; cv=none; d=google.com; s=arc-20160816; b=QoI7qrmbXBKpIj9FgAjU7DXdvTbg9V6uezXXUywIZke/KhJVN1K7YQ4w2+dU9BZtY9 zvrC03z9lB1vCgSZknTto0P4lz7f1Iz2WKcWOrNEWX1papONNf4MwBz8jTL+BoZhBUDS afrQhCIXtmbTqlkZDbNQSDplWVjrMiyPecN2so6U3NYR8ZY0FVSFo4FOV2fhx7TEgz/W hBSYO1Jz6l8XJWdVjoPwW570kOrPkSuVDnJgA3MvJkKz2LRw2Ze7qYPMbSDK0/6Hvb9Y OQ9tEYrciJIQ8cXj1SwXO52BAFcbZ0GWZTLMyZGRCZmfBxqNw/VrUn3k0l8RKjeNyNSN qH5w== 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=4/qw+AB5TuEWUJksEtVJF6hWLwr5ASWLtMb1EDmcvzg=; b=IYsXHGmI1y8PMj3zk2IrFn8cIXZu1I4Hao3jeOmEq2kTEmnYyW07SK1xg+vKY2V3Qj thoizM33QZjwiqypyFqBU6XwDLzoThcacKi2p3ftJqvouyank2oRwLxXTXkuKDxP56fK 4nKCcfHTdtkmYDNoZ9GCkZdCWcQ+2awDU++msPjlyCx30wtE8el6ZFcFa0K56uu2hkbz ZwSjAA5ne+cNh8KwbY9Xx6xTUraR9WbkF/gEeKabFJpf8/bDu9bbkmcmzdboDdxGju7W 8WkPeer8LeGhNPhCmqdCPlTFiVCMAxVRlTj1ydh3H25L62WFYGF12jp3QB94xNnaeYr5 3wSg== 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 i62-v6si231703pfc.217.2018.07.16.23.57.58; Mon, 16 Jul 2018 23:58:13 -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 S1728309AbeGQH22 (ORCPT + 99 others); Tue, 17 Jul 2018 03:28:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:49390 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727481AbeGQH22 (ORCPT ); Tue, 17 Jul 2018 03:28:28 -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 0B8FEACFA; Tue, 17 Jul 2018 06:57:21 +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 Subject: [PATCH 0/4] add crc64 calculation as kernel library Date: Tue, 17 Jul 2018 14:57:08 +0800 Message-Id: <20180717065711.28281-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. 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. Changelog: v2: combine first two patches into one fixes all review commennts of v1 v1: initial version. Coly Li Cc: Andy Shevchenko Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Thomas Gleixner Cc: Michael Lyle Cc: Kent Overstreet Cc: Kate Stewart --- Andy Shevchenko (1): lib/crc64: add crc64 option to lib/Kconfig 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/bcache.h | 7 +- drivers/md/bcache/btree.c | 2 +- drivers/md/bcache/request.c | 2 +- drivers/md/bcache/super.c | 5 +- drivers/md/bcache/util.c | 131 ---------------------------------- drivers/md/bcache/util.h | 5 +- include/linux/crc64.h | 15 ++++ lib/.gitignore | 2 + lib/Kconfig | 8 +++ lib/Kconfig.debug | 11 +++ lib/Makefile | 12 ++++ lib/crc64.c | 71 +++++++++++++++++++ lib/gen_crc64table.c | 76 ++++++++++++++++++++ lib/test_crc.c | 136 ++++++++++++++++++++++++++++++++++++ 14 files changed, 341 insertions(+), 142 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