From patchwork Mon May 12 01:39:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 4153571 X-Patchwork-Delegate: dave@jikos.cz 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 306B4BFF02 for ; Mon, 12 May 2014 01:38:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 550FF2018A for ; Mon, 12 May 2014 01:38:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 887D12017E for ; Mon, 12 May 2014 01:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750982AbaELBim (ORCPT ); Sun, 11 May 2014 21:38:42 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:31205 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750810AbaELBim (ORCPT ); Sun, 11 May 2014 21:38:42 -0400 X-IronPort-AV: E=Sophos;i="4.97,1031,1389715200"; d="scan'208";a="30375776" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 May 2014 09:36:07 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s4C1ccag026121 for ; Mon, 12 May 2014 09:38:38 +0800 Received: from adam-work.lan (10.167.226.24) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.146.2; Mon, 12 May 2014 09:38:43 +0800 From: Qu Wenruo To: Subject: [PATCH] btrfs-progs: Remove unneeded assert in find_good_parent(). Date: Mon, 12 May 2014 09:39:42 +0800 Message-ID: <1399858782-15109-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 1.9.2 MIME-Version: 1.0 X-Originating-IP: [10.167.226.24] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 find_good_parent() uses assert to deal with the problem that clone source's parent can't be found. But in fact the assert is somewhat overkilled since subvol_uuid_search() has enough error messages for debug and caller of find_good_parent() can handle the problems in find_good_parent(), so the assert can be removed without any problem. Signed-off-by: Qu Wenruo --- cmds-send.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmds-send.c b/cmds-send.c index ff17092..9a73b32 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -132,7 +132,10 @@ static int find_good_parent(struct btrfs_send *s, u64 root_id, u64 *found) parent2 = subvol_uuid_search(&s->sus, s->clone_sources[i], NULL, 0, NULL, subvol_search_by_root_id); - assert(parent2); + if (!parent2) { + ret = -ENOENT; + goto out; + } tmp = parent2->ctransid - parent->ctransid; if (tmp < 0) tmp *= -1;