This function just change a device item's uuid.
Signed-off-by: Qu Wenruo <quwenruo@xxxxxxxxxxxxxx>
---
v2:
Move to props.c
---
props.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/props.c b/props.c
index 33fc39b..6cd9b4d 100644
--- a/props.c
+++ b/props.c
@@ -287,6 +287,27 @@ out:
return ret;
}
+static int change_device_uuid(struct btrfs_root *root, struct extent_buffer *eb,
+ int slot)
+{
+ struct btrfs_fs_info *fs_info = root->fs_info;
+ struct btrfs_dev_item *di;
+ int ret = 0;
+
+ di = btrfs_item_ptr(eb, slot, struct btrfs_dev_item);
+ if (fs_info->new_fsid) {
+ if (!memcmp_extent_buffer(eb, fs_info->new_fsid,
+ (unsigned long)btrfs_device_fsid(di),
+ BTRFS_FSID_SIZE))
+ return ret;
+ write_extent_buffer(eb, fs_info->new_fsid,
+ (unsigned long)btrfs_device_fsid(di),
+ BTRFS_FSID_SIZE);
+ ret = write_tree_block(NULL, root, eb);
+ }
+ return ret;
+}
+
const struct prop_handler prop_handlers[] = {
{"ro", "Set/get read-only flag of subvolume.", 0, prop_object_subvol,
prop_read_only},
--
2.4.0
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html