From a2f7af94abe4a3491ca1280a2ae1d63edc0d62ab Mon Sep 17 00:00:00 2001 From: Prasanth K S R Date: Sat, 10 Dec 2016 19:17:43 +0530 Subject: btrfs-progs: subvol_uuid_search: return error encoded pointer This commit changes subvol_uuid_search() to return an error encoded pointer on failure. Signed-off-by: Prasanth K S R Signed-off-by: David Sterba --- cmds-receive.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmds-receive.c') diff --git a/cmds-receive.c b/cmds-receive.c index 6f54c2ed..cb42aa27 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -287,13 +287,13 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid, parent_subvol = subvol_uuid_search(&rctx->sus, 0, parent_uuid, parent_ctransid, NULL, subvol_search_by_received_uuid); - if (!parent_subvol) { + if (IS_ERR(parent_subvol)) { parent_subvol = subvol_uuid_search(&rctx->sus, 0, parent_uuid, parent_ctransid, NULL, subvol_search_by_uuid); } - if (!parent_subvol) { - ret = -ENOENT; + if (IS_ERR(parent_subvol)) { + ret = PTR_ERR(parent_subvol); error("cannot find parent subvolume"); goto out; } @@ -750,13 +750,13 @@ static int process_clone(const char *path, u64 offset, u64 len, si = subvol_uuid_search(&rctx->sus, 0, clone_uuid, clone_ctransid, NULL, subvol_search_by_received_uuid); - if (!si) { + if (IS_ERR(si)) { if (memcmp(clone_uuid, rctx->cur_subvol.received_uuid, BTRFS_UUID_SIZE) == 0) { /* TODO check generation of extent */ subvol_path = strdup(rctx->cur_subvol_path); } else { - ret = -ENOENT; + ret = PTR_ERR(si); error("clone: did not find source subvol"); goto out; } -- cgit v1.2.3