From patchwork Thu Feb 27 21:15:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410889 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18AE1924 for ; Thu, 27 Feb 2020 21:49:58 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 017B224690 for ; Thu, 27 Feb 2020 21:49:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 017B224690 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 4C40034A8D5; Thu, 27 Feb 2020 13:41:17 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 49D57220000 for ; Thu, 27 Feb 2020 13:20:48 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id E943F917B; Thu, 27 Feb 2020 16:18:18 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id E7F2946A; Thu, 27 Feb 2020 16:18:18 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:15:50 -0500 Message-Id: <1582838290-17243-483-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 482/622] lustre: obdclass: align to T10 sector size when generating guard X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Xi , Li Dongyang , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Andreas Dilger Otherwise the client and server would come up with different checksum when the page size is different. Improve test_810 to verify all available checksum types. WC-bug-id: https://jira.whamcloud.com/browse/LU-11729 Lustre-commit: 98ceaf854bb4 ("LU-11729 obdclass: align to T10 sector size when generating guard") Signed-off-by: Andreas Dilger Signed-off-by: Li Xi Signed-off-by: Li Dongyang Reviewed-on: https://review.whamcloud.com/34043 Reviewed-by: James Simmons Reviewed-by: Arshad Hussain Signed-off-by: James Simmons --- fs/lustre/obdclass/integrity.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/lustre/obdclass/integrity.c b/fs/lustre/obdclass/integrity.c index 5cb9a25..2d5760d 100644 --- a/fs/lustre/obdclass/integrity.c +++ b/fs/lustre/obdclass/integrity.c @@ -50,26 +50,26 @@ int obd_page_dif_generate_buffer(const char *obd_name, struct page *page, int *used_number, int sector_size, obd_dif_csum_fn *fn) { - unsigned int i; + unsigned int i = offset; + unsigned int end = offset + length; char *data_buf; u16 *guard_buf = guard_start; unsigned int data_size; int used = 0; data_buf = kmap(page) + offset; - for (i = 0; i < length; i += sector_size) { + while (i < end) { if (used >= guard_number) { CERROR("%s: unexpected used guard number of DIF %u/%u, data length %u, sector size %u: rc = %d\n", obd_name, used, guard_number, length, sector_size, -E2BIG); return -E2BIG; } - data_size = length - i; - if (data_size > sector_size) - data_size = sector_size; + data_size = min(round_up(i + 1, sector_size), end) - i; *guard_buf = fn(data_buf, data_size); guard_buf++; data_buf += data_size; + i += data_size; used++; } kunmap(page);