@@ -2297,11 +2297,7 @@ static int do_convert(const char *devname, int datacsum, int packing,
fprintf(stderr, "error during cleanup_sys_chunk %d\n", ret);
goto fail;
}
- ret = close_ctree(root);
- if (ret) {
- fprintf(stderr, "error during close_ctree %d\n", ret);
- goto fail;
- }
+ close_ctree(root);
close_ext2fs(ext2_fs);
/*
@@ -2325,7 +2321,7 @@ static int do_convert(const char *devname, int datacsum, int packing,
fprintf(stderr, "error during fixup_chunk_tree\n");
goto fail;
}
- ret = close_ctree(root);
+ close_ctree(root);
close(fd);
printf("conversion complete.\n");
@@ -2591,11 +2587,7 @@ next_extent:
ret = btrfs_commit_transaction(trans, root);
BUG_ON(ret);
- ret = close_ctree(root);
- if (ret) {
- fprintf(stderr, "error during close_ctree %d\n", ret);
- goto fail;
- }
+ close_ctree(root);
/* zero btrfs super block mirrors */
memset(buf, 0, sectorsize);
@@ -408,5 +408,6 @@ no_node:
printf("uuid %s\n", uuidbuf);
printf("%s\n", BTRFS_BUILD_VERSION);
close_root:
- return close_ctree(root);
+ close_ctree(root);
+ return 0;
}
@@ -1333,8 +1333,8 @@ out:
metadump_destroy(&metadump, num_threads);
btrfs_free_path(path);
- ret = close_ctree(root);
- return err ? err : ret;
+ close_ctree(root);
+ return err ? err : 0;
}
static void update_super_old(u8 *buffer)
@@ -1410,7 +1410,7 @@ int write_ctree_super(struct btrfs_trans_handle *trans,
return ret;
}
-int close_ctree(struct btrfs_root *root)
+void close_ctree(struct btrfs_root *root)
{
int ret;
struct btrfs_trans_handle *trans;
@@ -1436,7 +1436,6 @@ int close_ctree(struct btrfs_root *root)
btrfs_close_devices(fs_info->fs_devices);
btrfs_cleanup_all_caches(fs_info);
btrfs_free_fs_info(fs_info);
- return 0;
}
int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
@@ -78,7 +78,7 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr,
struct btrfs_fs_info *open_ctree_fs_info(const char *filename,
u64 sb_bytenr, u64 root_tree_bytenr,
enum btrfs_open_ctree_flags flags);
-int close_ctree(struct btrfs_root *root);
+void close_ctree(struct btrfs_root *root);
int write_all_supers(struct btrfs_root *root);
int write_ctree_super(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
@@ -1661,8 +1661,7 @@ raid_groups:
BUG_ON(ret);
}
- ret = close_ctree(root);
- BUG_ON(ret);
+ close_ctree(root);
free(label);
return 0;
}
The close_ctree always returns 0 and the stuff that depends on its return value is of no sense. Just make close_ctree return void. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> --- btrfs-convert.c | 14 +++----------- btrfs-debug-tree.c | 3 ++- btrfs-image.c | 4 ++-- disk-io.c | 3 +-- disk-io.h | 2 +- mkfs.c | 3 +-- 6 files changed, 10 insertions(+), 19 deletions(-)