btrfs-progs: Remove all btrfs_close_all_devices in sub-command
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 26 Oct 2015 10:28:19 +0000 (18:28 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 2 Nov 2015 08:35:07 +0000 (09:35 +0100)
Since we have btrfs_close_all_devices() in btrfs's main entrance,
it is not necessary to call btrfs_close_all_devices() separately
in each sub-command.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c
cmds-device.c
cmds-replace.c

index 4040f7e..fd661d9 100644 (file)
@@ -9735,7 +9735,6 @@ out:
        free_root_recs_tree(&root_cache);
 close_out:
        close_ctree(root);
-       btrfs_close_all_devices();
 err_out:
        if (ctx.progress_enabled)
                task_deinit(ctx.info);
index e461aa1..c2f3a40 100644 (file)
@@ -138,7 +138,6 @@ static int cmd_device_add(int argc, char **argv)
 
 error_out:
        close_file_or_dir(fdmnt, dirstream);
-       btrfs_close_all_devices();
        return !!ret;
 }
 
@@ -287,7 +286,6 @@ static int cmd_device_scan(int argc, char **argv)
        }
 
 out:
-       btrfs_close_all_devices();
        return !!ret;
 }
 
@@ -456,7 +454,6 @@ static int cmd_device_stats(int argc, char **argv)
 out:
        free(di_args);
        close_file_or_dir(fdmnt, dirstream);
-       btrfs_close_all_devices();
 
        return err;
 }
index 4e0e947..9ba256d 100644 (file)
@@ -309,7 +309,6 @@ static int cmd_replace_start(int argc, char **argv)
                }
        }
        close_file_or_dir(fdmnt, dirstream);
-       btrfs_close_all_devices();
        return 0;
 
 leave_with_error:
@@ -319,7 +318,6 @@ leave_with_error:
                close(fdmnt);
        if (fddstdev != -1)
                close(fddstdev);
-       btrfs_close_all_devices();
        return 1;
 }