diff mbox

[v2,2/5] btrfs-progs: Remove all btrfs_close_all_devices in sub-command

Message ID 100cdd79193c6a61f4e41493281be1d374bae4c0.1445855131.git.zhaolei@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Zhaolei Oct. 26, 2015, 10:28 a.m. UTC
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>
---
 cmds-check.c   | 1 -
 cmds-device.c  | 3 ---
 cmds-replace.c | 2 --
 3 files changed, 6 deletions(-)
diff mbox

Patch

diff --git a/cmds-check.c b/cmds-check.c
index 1f8caad..3af6e61 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -9738,7 +9738,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);
diff --git a/cmds-device.c b/cmds-device.c
index 5f2b952..620ae8b 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -139,7 +139,6 @@  static int cmd_device_add(int argc, char **argv)
 
 error_out:
 	close_file_or_dir(fdmnt, dirstream);
-	btrfs_close_all_devices();
 	return !!ret;
 }
 
@@ -288,7 +287,6 @@  static int cmd_device_scan(int argc, char **argv)
 	}
 
 out:
-	btrfs_close_all_devices();
 	return !!ret;
 }
 
@@ -466,7 +464,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;
 }
diff --git a/cmds-replace.c b/cmds-replace.c
index 9ab8438..fadd2cd 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -330,7 +330,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:
@@ -340,7 +339,6 @@  leave_with_error:
 		close(fdmnt);
 	if (fddstdev != -1)
 		close(fddstdev);
-	btrfs_close_all_devices();
 	return 1;
 }