From patchwork Wed May 24 07:41:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13253406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C040DC7EE23 for ; Wed, 24 May 2023 07:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239973AbjEXHly (ORCPT ); Wed, 24 May 2023 03:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239935AbjEXHlw (ORCPT ); Wed, 24 May 2023 03:41:52 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D9A9D for ; Wed, 24 May 2023 00:41:50 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7A91B22435 for ; Wed, 24 May 2023 07:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1684914108; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Afj5KjS1/SoBMFyZ5TXQbbYwXUu8NIBfk3bXfxBSuxs=; b=XHzpvYFGJv48HNzAdGsMqOVN0VsnqSup1YlU5fLGe9n/SERUz5V3O5cYByioozegxS9LnY RxS78Dgq06ajdd1ITHo7Dlb2eKJA2TWTdiHVAw7GGe9cqsndMfB1HzhMskZFsmxjvvb4am I9upPtUEZlZq0r3WUDz+mgltVv0Uy2s= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D08C113425 for ; Wed, 24 May 2023 07:41:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qPs/Jru/bWSiRQAAMHmgww (envelope-from ) for ; Wed, 24 May 2023 07:41:47 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 0/7] btrfs-progs: tune: add resume support for csum conversion Date: Wed, 24 May 2023 15:41:23 +0800 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org [RESUME SUPPORT] This patchset adds the resume support for "btrfstune --csum". The main part is in resume for data csum change, as we have 4 different status during data csum conversion. Thankfully for data csum conversion, everything is protected by metadata COW and we can detect the current status by the existence of both old and new csum items, and their coverage. For resume of metadata conversion, there is nothing we can really do but go through all the tree blocks and verify them against both new and old csum type. [TESTING] For the tests, currently errors are injected after every possible transaction commit, and then resume from that interrupted status. So far the patchset passes all above tests. But I'm not sure what's the better way to craft the test case. Should we go log-writes? Or use pre-built images? [TODO] - Test cases for resume - Support for revert if errors are found If we hit data csum mismatch and can not repair from any copy, then we should revert back to the old csum. - Support for pre-cautious metadata check We'd better read and very metadata before rewriting them. - Performance tuning We want to take a balance between too frequent commit transaction and too large transaction. This is especially true for data csum objectid change and maybe old data csum deletion. - UI enhancement A btrfs-convert like UI would be better. Qu Wenruo (7): btrfs-progs: tune: implement resume support for metadata checksum btrfs-progs: tune: implement resume support for generating new data csum btrfs-progs: tune: implement resume support for csum tree without any new csum item btrfs-progs: tune: implement resume support for empty csum tree btrfs-progs: tune: implement resume support for half deleted old csums btrfs-progs: tune: implement resume support for data csum objectid change btrfs-progs: tune: reject csum change if the fs is already using the target csum type tune/change-csum.c | 461 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 418 insertions(+), 43 deletions(-)