parent_subvol is local to process_snapshot() and not needed outside.

Signed-off-by: Stefan Behrens <[email protected]>
---
 cmds-receive.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/cmds-receive.c b/cmds-receive.c
index 8afffe6..081665f 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -63,7 +63,6 @@ struct btrfs_receive
        char *full_subvol_path;
 
        struct subvol_info *cur_subvol;
-       struct subvol_info *parent_subvol;
 
        struct subvol_uuid_search sus;
 };
@@ -151,7 +150,6 @@ static int process_subvol(const char *path, const u8 *uuid, 
u64 ctransid,
                goto out;
 
        r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));
-       r->parent_subvol = NULL;
 
        r->cur_subvol->path = strdup(path);
        free(r->full_subvol_path);
@@ -191,13 +189,13 @@ static int process_snapshot(const char *path, const u8 
*uuid, u64 ctransid,
        struct btrfs_receive *r = user;
        char uuid_str[128];
        struct btrfs_ioctl_vol_args_v2 args_v2;
+       struct subvol_info *parent_subvol;
 
        ret = finish_subvol(r);
        if (ret < 0)
                goto out;
 
        r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));
-       r->parent_subvol = NULL;
 
        r->cur_subvol->path = strdup(path);
        free(r->full_subvol_path);
@@ -221,9 +219,9 @@ static int process_snapshot(const char *path, const u8 
*uuid, u64 ctransid,
        memset(&args_v2, 0, sizeof(args_v2));
        strncpy_null(args_v2.name, path);
 
-       r->parent_subvol = subvol_uuid_search(&r->sus, 0, parent_uuid,
+       parent_subvol = subvol_uuid_search(&r->sus, 0, parent_uuid,
                        parent_ctransid, NULL, subvol_search_by_received_uuid);
-       if (!r->parent_subvol) {
+       if (!parent_subvol) {
                ret = -ENOENT;
                fprintf(stderr, "ERROR: could not find parent subvolume\n");
                goto out;
@@ -239,12 +237,12 @@ static int process_snapshot(const char *path, const u8 
*uuid, u64 ctransid,
                }
        }*/
 
-       args_v2.fd = openat(r->mnt_fd, r->parent_subvol->path,
+       args_v2.fd = openat(r->mnt_fd, parent_subvol->path,
                        O_RDONLY | O_NOATIME);
        if (args_v2.fd < 0) {
                ret = -errno;
                fprintf(stderr, "ERROR: open %s failed. %s\n",
-                               r->parent_subvol->path, strerror(-ret));
+                               parent_subvol->path, strerror(-ret));
                goto out;
        }
 
@@ -253,7 +251,7 @@ static int process_snapshot(const char *path, const u8 
*uuid, u64 ctransid,
        if (ret < 0) {
                ret = -errno;
                fprintf(stderr, "ERROR: creating snapshot %s -> %s "
-                               "failed. %s\n", r->parent_subvol->path,
+                               "failed. %s\n", parent_subvol->path,
                                path, strerror(-ret));
                goto out;
        }
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to