From patchwork Fri Mar 29 19:35:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 10877675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE28A15AC for ; Fri, 29 Mar 2019 19:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD97A28AA1 for ; Fri, 29 Mar 2019 19:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A265529065; Fri, 29 Mar 2019 19:35:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E46728AA1 for ; Fri, 29 Mar 2019 19:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729901AbfC2Tfa (ORCPT ); Fri, 29 Mar 2019 15:35:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:42186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729380AbfC2Tfa (ORCPT ); Fri, 29 Mar 2019 15:35:30 -0400 Received: from localhost.localdomain (bl8-197-74.dsl.telepac.pt [85.241.197.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D29A2184D for ; Fri, 29 Mar 2019 19:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553888129; bh=UKDZLimjZ//0SXyz19I+gzyboi6C9DFV6Nn2SHUYQyw=; h=From:To:Subject:Date:From; b=JD1n/OQf7upVEg7LtbHF/MmR+3/mZossPdmzcbRJLNYRxrfNoznkrzkliiPWxI5rn xpJ8Px2kPgDA2gonFPVpIyXQCzqj3ygg01lcBHh3UZe8ZA1EXdNhKF8psqub2riRrp mdUh+8pxavFmf1+sQwZPssvhcIq7sSu/lRQUtkts= From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs-progs: receive, add debug information to write and clone commands Date: Fri, 29 Mar 2019 19:35:26 +0000 Message-Id: <20190329193526.21315-1-fdmanana@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Filipe Manana Currently, when operating in a more verbose mode (-vv), the receive command does not mention any write or clone commands, unlike other commands. This change adds debug messages for the write and clone operations, that do not include data but only offsets and lengths, as this is actually very useful to debug a send stream and I use it frequently. Signed-off-by: Filipe Manana --- cmds-receive.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmds-receive.c b/cmds-receive.c index 3888149a..5d06f286 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -704,6 +704,10 @@ static int process_write(const char *path, const void *data, u64 offset, if (ret < 0) goto out; + if (g_verbose >= 2) + fprintf(stderr, "write %s - offset=%llu length=%llu\n", + path, offset, len); + while (pos < len) { w = pwrite(rctx->write_fd, (char*)data + pos, len - pos, offset + pos); @@ -808,6 +812,11 @@ static int process_clone(const char *path, u64 offset, u64 len, goto out; } + if (g_verbose >= 2) + fprintf(stderr, + "clone %s - source=%s source offset=%llu offset=%llu length=%llu\n", + path, clone_path, clone_offset, offset, len); + clone_args.src_fd = clone_fd; clone_args.src_offset = clone_offset; clone_args.src_length = len;