From patchwork Tue Jun 9 07:57:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 6570511 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D13AFC0020 for ; Tue, 9 Jun 2015 09:02:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED2F320497 for ; Tue, 9 Jun 2015 09:02:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D775720494 for ; Tue, 9 Jun 2015 09:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932181AbbFIJCA (ORCPT ); Tue, 9 Jun 2015 05:02:00 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:7372 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750868AbbFIJBw (ORCPT ); Tue, 9 Jun 2015 05:01:52 -0400 X-IronPort-AV: E=Sophos;i="5.01,1,1399996800"; d="scan'208";a="96715634" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Jun 2015 17:06:03 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t597wBdd015717 for ; Tue, 9 Jun 2015 15:58:12 +0800 Received: from localhost.localdomain (10.167.226.33) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 9 Jun 2015 15:59:46 +0800 From: Qu Wenruo To: Subject: [PATCH] btrfs-progs: convert: Print different error message if convert partly failed. Date: Tue, 9 Jun 2015 15:57:40 +0800 Message-ID: <1433836660-1163-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.4.2 MIME-Version: 1.0 X-Originating-IP: [10.167.226.33] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When testing under libguestfs, btrfs-convert will never succeed to fix chunk map, and always fails. But in that case, it's already a mountable btrfs. So better to info user with different error message for that case. The root cause of it is still under investigation. Signed-off-by: Qu Wenruo --- btrfs-convert.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/btrfs-convert.c b/btrfs-convert.c index 9a9d619..5606156 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -2286,6 +2286,7 @@ static int do_convert(const char *devname, int datacsum, int packing, int noxatt { int i, ret, blocks_per_node; int fd = -1; + int is_btrfs = 0; u32 blocksize; u64 blocks[7]; u64 total_bytes; @@ -2435,6 +2436,7 @@ static int do_convert(const char *devname, int datacsum, int packing, int noxatt fprintf(stderr, "unable to migrate super block\n"); goto fail; } + is_btrfs = 1; root = open_ctree_fd(fd, devname, 0, OPEN_CTREE_WRITES); if (!root) { @@ -2455,7 +2457,11 @@ static int do_convert(const char *devname, int datacsum, int packing, int noxatt fail: if (fd != -1) close(fd); - fprintf(stderr, "conversion aborted.\n"); + if (is_btrfs) + fprintf(stderr, + "some error happened, but still converted to btrfs\n"); + else + fprintf(stderr, "conversion aborted\n"); return -1; }