Qu Wenruo
2014-May-12 01:39 UTC
[PATCH] btrfs-progs: Remove unneeded assert in find_good_parent().
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 <quwenruo@cn.fujitsu.com>
---
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;
--
1.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html