From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B05CC433F5 for ; Thu, 30 Sep 2021 11:49:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 602FF619BB for ; Thu, 30 Sep 2021 11:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350602AbhI3Lu5 (ORCPT ); Thu, 30 Sep 2021 07:50:57 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:54730 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350599AbhI3Lu5 (ORCPT ); Thu, 30 Sep 2021 07:50:57 -0400 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-out2.suse.de (Postfix) with ESMTPS id 085302001E for ; Thu, 30 Sep 2021 11:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1633002554; 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=NcriuOlu/vv7yTPD7aFh1atkPxs+4WSMjTstSuqQqwA=; b=KT7pBfOANiB9bAJ+OSDvjBi4SQwA0YV/am2tnf/7NzGo99+4KAl/90zZxCXEB/Usct63tI 8q/ujlvektTAQlygYkyo29pRaqxC2jzadHBw2z6NyXl9GzJFlGlC3RAC8yYryrmTlnComx 30QogXWwCrfKcgajoJvEXcIMLDHbxhQ= 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 5852113B05 for ; Thu, 30 Sep 2021 11:49:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id u0mHCDmkVWELJQAAMHmgww (envelope-from ) for ; Thu, 30 Sep 2021 11:49:13 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 0/2] btrfs-progs: receive: introduce new --clone-fallback option Date: Thu, 30 Sep 2021 19:48:53 +0800 Message-Id: <20210930114855.39225-1-wqu@suse.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org When parent stream and incremental stream are received with different nodatasum mount options, any clone opeartion in the incremental stream will be rejected by kernel. There are more situations to cause clone failure, like receiving a stream on a fs with different sectorsize. Thus this patchset will introduce a new option, --clone-fallback, for btrfs receive to fall back to buffered write when clone failed. This fall back behavior will only happen if the new option is explicitly specified, as such behavior can hide some send bugs, and under most sane cases users don't need such option. Also add a test case for the new option. Changelog: RFC->v1: - Introduce a new option for the fallback behavior To avoid hide send bugs. - Hide the warning message behind -v option Since we have a special option for it thus users are aware of what they are doing, there is no need to output such warning by default. - Add a new test case for it v2: - Add the missing help string for --clone-fallback option - Rephrase the words in comments and commit messages - Add run_check_remount_test_dev() helper Qu Wenruo (2): btrfs-progs: receive: fallback to buffered copy if clone failed btrfs-progs: misc-tests: add test case for receive --clone-fallback Documentation/btrfs-receive.asciidoc | 12 ++++ cmds/receive.c | 62 ++++++++++++++++++- tests/common | 9 +++ .../049-receive-clone-fallback/test.sh | 58 +++++++++++++++++ 4 files changed, 138 insertions(+), 3 deletions(-) create mode 100755 tests/misc-tests/049-receive-clone-fallback/test.sh -- 2.33.0