summaryrefslogtreecommitdiff
path: root/btrfstune.c
diff options
context:
space:
mode:
Diffstat (limited to 'btrfstune.c')
-rw-r--r--btrfstune.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/btrfstune.c b/btrfstune.c
index e8e3d00a..1ed73a92 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -32,6 +32,7 @@
#include "transaction.h"
#include "utils.h"
#include "volumes.h"
+#include "help.h"
static char *device;
static int force = 0;
@@ -110,7 +111,7 @@ static int change_header_uuid(struct btrfs_root *root, struct extent_buffer *eb)
write_extent_buffer(eb, fs_info->new_chunk_tree_uuid,
btrfs_header_chunk_tree_uuid(eb),
BTRFS_UUID_SIZE);
- ret = write_tree_block(NULL, root, eb);
+ ret = write_tree_block(NULL, fs_info, eb);
return ret;
}
@@ -148,7 +149,7 @@ static int change_extents_uuid(struct btrfs_fs_info *fs_info)
goto next;
bytenr = key.objectid;
- eb = read_tree_block(root, bytenr, root->nodesize, 0);
+ eb = read_tree_block(fs_info, bytenr, fs_info->nodesize, 0);
if (IS_ERR(eb)) {
error("failed to read tree block: %llu", bytenr);
ret = PTR_ERR(eb);
@@ -176,10 +177,9 @@ out:
return ret;
}
-static int change_device_uuid(struct btrfs_root *root, struct extent_buffer *eb,
+static int change_device_uuid(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
int slot)
{
- struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_dev_item *di;
int ret = 0;
@@ -192,7 +192,7 @@ static int change_device_uuid(struct btrfs_root *root, struct extent_buffer *eb,
write_extent_buffer(eb, fs_info->new_fsid,
(unsigned long)btrfs_device_fsid(di),
BTRFS_FSID_SIZE);
- ret = write_tree_block(NULL, root, eb);
+ ret = write_tree_block(NULL, fs_info, eb);
return ret;
}
@@ -215,7 +215,7 @@ static int change_devices_uuid(struct btrfs_fs_info *fs_info)
if (key.type != BTRFS_DEV_ITEM_KEY ||
key.objectid != BTRFS_DEV_ITEMS_OBJECTID)
goto next;
- ret = change_device_uuid(root, path.nodes[0], path.slots[0]);
+ ret = change_device_uuid(fs_info, path.nodes[0], path.slots[0]);
if (ret < 0)
goto out;
next:
@@ -242,7 +242,7 @@ static int change_fsid_prepare(struct btrfs_fs_info *fs_info)
btrfs_set_super_flags(fs_info->super_copy, flags);
memcpy(fs_info->super_copy->fsid, fs_info->new_fsid, BTRFS_FSID_SIZE);
- ret = write_all_supers(tree_root);
+ ret = write_all_supers(fs_info);
if (ret < 0)
return ret;
@@ -250,7 +250,7 @@ static int change_fsid_prepare(struct btrfs_fs_info *fs_info)
write_extent_buffer(tree_root->node, fs_info->new_chunk_tree_uuid,
btrfs_header_chunk_tree_uuid(tree_root->node),
BTRFS_UUID_SIZE);
- return write_tree_block(NULL, tree_root, tree_root->node);
+ return write_tree_block(NULL, fs_info, tree_root->node);
}
static int change_fsid_done(struct btrfs_fs_info *fs_info)
@@ -260,7 +260,7 @@ static int change_fsid_done(struct btrfs_fs_info *fs_info)
flags &= ~BTRFS_SUPER_FLAG_CHANGING_FSID;
btrfs_set_super_flags(fs_info->super_copy, flags);
- return write_all_supers(fs_info->tree_root);
+ return write_all_supers(fs_info);
}
/*
@@ -354,7 +354,7 @@ static int change_uuid(struct btrfs_fs_info *fs_info, const char *new_fsid_str)
BTRFS_FSID_SIZE);
memcpy(fs_info->super_copy->fsid, fs_info->new_fsid,
BTRFS_FSID_SIZE);
- ret = write_all_supers(fs_info->tree_root);
+ ret = write_all_supers(fs_info);
if (ret < 0)
goto out;