Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp444150pxb; Tue, 3 Nov 2020 03:55:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3xqnNVeSRb8D8gHxAIO9HuliMFkLq3uVBI5IrRif6OiB4h+saCATL/4DPWO2kMLMPno9w X-Received: by 2002:a17:906:9458:: with SMTP id z24mr11670823ejx.318.1604404531154; Tue, 03 Nov 2020 03:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604404531; cv=none; d=google.com; s=arc-20160816; b=zW+bh4yFbpYkVobQIi4/Q6mKO13g7ifBgW3XIFVHE7zCh1PuK2N+okWZo5t2URn8U0 hqkdnlHsGP+i7pELrghHX9Fr+TxO4baGnSW6bt6rs97WtU6SwTY30SoVz0PoTkA4sNEA zqtlA2Nc8lLsAQWNnY0kMhUAGteHQOL7aKB0vexW7BeT2XCl2sWfCA71MofF2umQY7zX oGYd/qEQ0e5KltTVkjoufHih13WqxFs5phfA5vLcpSRMIMLeOQkWvzJ3KuM3JlgjkugN /840uhr21/zYzGttNPkrKUcYsC4f52Tx++tOB1ZLe5nA6aTG0bYpMbuXUS2OztrSK/Xw zEHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=vaUfiUGSmVMGqlMmp7pWT7aMBBWJcqzCQIXK+gU6wF4=; b=q53zcXeznEPq/cyvf6ECayFDD3vpK2c9pJcd7ggQ7GMdkD+f5BZGPNeRpCjDzxconO aCqD2S0B2G0yRAGOq+SzpcM4+eQb8I+3BS3QPci7QlV9DNgp6cfZjjIT/HZWtuM7BVrp 3znzrROHPhRvzJTO10KGXwDYyxvczBEw1dT8VmWk8O15I4vofJEVkFuQgrjETugYOl/U 0PESMKBb8Kr95hZxnqHAamS5MNBpdNf6ENTpzH0fc0KDy/fTG0V9SGJl+Cwh6ksWqi4o 9g0JmxJrLaP3oIlNvnefwiOnjWsfxiFbUazf/g8JpFW5Wj3RNveK52IT9SaJulz3b8uF 7dyg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x14si2332241edq.219.2020.11.03.03.55.08; Tue, 03 Nov 2020 03:55:31 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728206AbgKCLvO (ORCPT + 99 others); Tue, 3 Nov 2020 06:51:14 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:6695 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727109AbgKCLvN (ORCPT ); Tue, 3 Nov 2020 06:51:13 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CQSmF0G0nz15QTk; Tue, 3 Nov 2020 19:51:09 +0800 (CST) Received: from [10.136.114.67] (10.136.114.67) by smtp.huawei.com (10.3.19.210) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 3 Nov 2020 19:51:05 +0800 Subject: Re: [f2fs-dev] [PATCH] f2fs: compress: support chksum To: David Laight , Jaegeuk Kim CC: "linux-kernel@vger.kernel.org" , "linux-f2fs-devel@lists.sourceforge.net" References: <20201102122333.76667-1-yuchao0@huawei.com> <20201102163123.GD529594@google.com> <756e482c-b638-1c09-3868-ae45d33ed2c2@huawei.com> <6b5bce0e-c967-b9cf-3544-a8e65595059c@huawei.com> From: Chao Yu Message-ID: <4d58b7c7-70b5-514d-fab2-27a0f16886e5@huawei.com> Date: Tue, 3 Nov 2020 19:51:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.114.67] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/3 18:35, David Laight wrote: > From: Chao Yu >> Sent: 03 November 2020 02:37 > ... >>>> Do we need to change fsck.f2fs to recover this? >> >> However, we don't know which one is correct, compressed data or chksum value? >> if compressed data was corrupted, repairing chksum value doesn't help. >> >> Or how about adding chksum values for both raw data and compressed data. > > What errors are you trying to detect? Hi, The original intention of adding this checksum feature is for code debug purpose when I develop compress framework in f2fs and add more compress algorithms into the framework, it helps to find obvious implementation bug, however this checksum feature was not fully designed, so that I didn't upstream it at that time. One other concern is to find any mismatch between original raw data and persisted data, no matter how it becomes to mismatched and then return error code to user if it detects the mismatch. And then fsck can repair mismatched chksum in the condition one persisted chksum matchs to calculated one, and one other doesn't. Thanks, > > If there are errors in the data then 'fixing' the checksum is pointless. > (You've got garbage data - might as well not have the checksum). > > If you are worried about the implementation of the compression > algorithm then a checksum of the raw data is needed. > > If you want to try error correcting burst errors in the compressed > data then a crc of the compressed data can be used for error correction. > > OTOH the most likely error is that the file meta-data and data sector > weren't both committed to disk when the system crashed. > In which case the checksum has done its job and the file is corrupt. > fsck should probably move the file to 'lost+found' for manual checking. > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) > > . >