@@ -1187,7 +1187,7 @@ static int __rebuild_device_items(struct btrfs_trans_handle *trans,
key.offset = dev->devid;
btrfs_set_stack_device_generation(dev_item, 0);
- btrfs_set_stack_device_type(dev_item, dev->type);
+ btrfs_set_stack_device_flags(dev_item, dev->flags);
btrfs_set_stack_device_id(dev_item, dev->devid);
btrfs_set_stack_device_total_bytes(dev_item, dev->total_bytes);
btrfs_set_stack_device_bytes_used(dev_item, dev->bytes_used);
@@ -155,7 +155,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
uuid_generate(device->uuid);
device->fs_info = fs_info;
device->devid = 0;
- device->type = 0;
+ device->flags = 0;
device->io_width = io_width;
device->io_align = io_align;
device->sector_size = sectorsize;
@@ -193,7 +193,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
btrfs_set_super_bytenr(disk_super, BTRFS_SUPER_INFO_OFFSET);
btrfs_set_stack_device_id(dev_item, device->devid);
- btrfs_set_stack_device_type(dev_item, device->type);
+ btrfs_set_stack_device_flags(dev_item, device->flags);
btrfs_set_stack_device_io_align(dev_item, device->io_align);
btrfs_set_stack_device_io_width(dev_item, device->io_width);
btrfs_set_stack_device_sector_size(dev_item, device->sector_size);
@@ -336,7 +336,7 @@ static int insert_temp_dev_item(int fd, struct extent_buffer *buf,
btrfs_set_device_io_align(buf, dev_item, cfg->sectorsize);
btrfs_set_device_io_width(buf, dev_item, cfg->sectorsize);
btrfs_set_device_sector_size(buf, dev_item, cfg->sectorsize);
- btrfs_set_device_type(buf, dev_item, 0);
+ btrfs_set_device_flags(buf, dev_item, 0);
/* Super dev_item is not complete, copy the complete one to sb */
read_extent_buffer(buf, &super.dev_item, (unsigned long)dev_item,
@@ -2942,7 +2942,7 @@ static int update_disk_super_on_device(struct btrfs_fs_info *info,
struct btrfs_super_block disk_super;
char dev_uuid[BTRFS_UUID_SIZE];
char fs_uuid[BTRFS_UUID_SIZE];
- u64 devid, type, io_align, io_width;
+ u64 devid, flags, io_align, io_width;
u64 sector_size, total_bytes, bytes_used;
int fp = -1;
int ret;
@@ -2972,7 +2972,7 @@ static int update_disk_super_on_device(struct btrfs_fs_info *info,
goto out;
}
- type = btrfs_device_type(leaf, dev_item);
+ flags = btrfs_device_flags(leaf, dev_item);
io_align = btrfs_device_io_align(leaf, dev_item);
io_width = btrfs_device_io_width(leaf, dev_item);
sector_size = btrfs_device_sector_size(leaf, dev_item);
@@ -2997,7 +2997,7 @@ static int update_disk_super_on_device(struct btrfs_fs_info *info,
dev_item = &disk_super.dev_item;
- btrfs_set_stack_device_type(dev_item, type);
+ btrfs_set_stack_device_flags(dev_item, flags);
btrfs_set_stack_device_id(dev_item, devid);
btrfs_set_stack_device_total_bytes(dev_item, total_bytes);
btrfs_set_stack_device_bytes_used(dev_item, bytes_used);
@@ -249,8 +249,8 @@ struct btrfs_dev_item {
/* minimal io size for this device */
__le32 sector_size;
- /* type and info about this device */
- __le64 type;
+ /* device flags (e.g. allocation hint) */
+ __le64 flags;
/* expected generation for this device */
__le64 generation;
@@ -1605,7 +1605,7 @@ static inline void btrfs_set_##name(type *s, u##bits val) \
s->member = cpu_to_le##bits(val); \
}
-BTRFS_SETGET_FUNCS(device_type, struct btrfs_dev_item, type, 64);
+BTRFS_SETGET_FUNCS(device_flags, struct btrfs_dev_item, flags, 64);
BTRFS_SETGET_FUNCS(device_total_bytes, struct btrfs_dev_item, total_bytes, 64);
BTRFS_SETGET_FUNCS(device_bytes_used, struct btrfs_dev_item, bytes_used, 64);
BTRFS_SETGET_FUNCS(device_io_align, struct btrfs_dev_item, io_align, 32);
@@ -1619,7 +1619,7 @@ BTRFS_SETGET_FUNCS(device_seek_speed, struct btrfs_dev_item, seek_speed, 8);
BTRFS_SETGET_FUNCS(device_bandwidth, struct btrfs_dev_item, bandwidth, 8);
BTRFS_SETGET_FUNCS(device_generation, struct btrfs_dev_item, generation, 64);
-BTRFS_SETGET_STACK_FUNCS(stack_device_type, struct btrfs_dev_item, type, 64);
+BTRFS_SETGET_STACK_FUNCS(stack_device_flags, struct btrfs_dev_item, flags, 64);
BTRFS_SETGET_STACK_FUNCS(stack_device_total_bytes, struct btrfs_dev_item,
total_bytes, 64);
BTRFS_SETGET_STACK_FUNCS(stack_device_bytes_used, struct btrfs_dev_item,
@@ -2099,7 +2099,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info)
continue;
btrfs_set_stack_device_generation(dev_item, 0);
- btrfs_set_stack_device_type(dev_item, dev->type);
+ btrfs_set_stack_device_flags(dev_item, dev->flags);
btrfs_set_stack_device_id(dev_item, dev->devid);
btrfs_set_stack_device_total_bytes(dev_item, dev->total_bytes);
btrfs_set_stack_device_bytes_used(dev_item, dev->bytes_used);
@@ -304,7 +304,7 @@ static void print_dev_item(struct extent_buffer *eb,
btrfs_device_io_align(eb, dev_item),
btrfs_device_io_width(eb, dev_item),
btrfs_device_sector_size(eb, dev_item),
- (unsigned long long)btrfs_device_type(eb, dev_item),
+ (unsigned long long)btrfs_device_flags(eb, dev_item),
(unsigned long long)btrfs_device_generation(eb, dev_item),
(unsigned long long)btrfs_device_start_offset(eb, dev_item),
btrfs_device_group(eb, dev_item),
@@ -2052,7 +2052,7 @@ void btrfs_print_superblock(struct btrfs_super_block *sb, int full)
cmp_res ? "[match]" : "[DON'T MATCH]");
printf("dev_item.type\t\t%llu\n", (unsigned long long)
- btrfs_stack_device_type(&sb->dev_item));
+ btrfs_stack_device_flags(&sb->dev_item));
printf("dev_item.total_bytes\t%llu\n", (unsigned long long)
btrfs_stack_device_total_bytes(&sb->dev_item));
printf("dev_item.bytes_used\t%llu\n", (unsigned long long)
@@ -992,7 +992,7 @@ int btrfs_add_device(struct btrfs_trans_handle *trans,
device->devid = free_devid;
btrfs_set_device_id(leaf, dev_item, device->devid);
btrfs_set_device_generation(leaf, dev_item, 0);
- btrfs_set_device_type(leaf, dev_item, device->type);
+ btrfs_set_device_flags(leaf, dev_item, device->flags);
btrfs_set_device_io_align(leaf, dev_item, device->io_align);
btrfs_set_device_io_width(leaf, dev_item, device->io_width);
btrfs_set_device_sector_size(leaf, dev_item, device->sector_size);
@@ -1050,7 +1050,7 @@ int btrfs_update_device(struct btrfs_trans_handle *trans,
dev_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dev_item);
btrfs_set_device_id(leaf, dev_item, device->devid);
- btrfs_set_device_type(leaf, dev_item, device->type);
+ btrfs_set_device_flags(leaf, dev_item, device->flags);
btrfs_set_device_io_align(leaf, dev_item, device->io_align);
btrfs_set_device_io_width(leaf, dev_item, device->io_width);
btrfs_set_device_sector_size(leaf, dev_item, device->sector_size);
@@ -2302,7 +2302,7 @@ static int fill_device_from_item(struct extent_buffer *leaf,
device->devid = btrfs_device_id(leaf, dev_item);
device->total_bytes = btrfs_device_total_bytes(leaf, dev_item);
device->bytes_used = btrfs_device_bytes_used(leaf, dev_item);
- device->type = btrfs_device_type(leaf, dev_item);
+ device->flags = btrfs_device_flags(leaf, dev_item);
device->io_align = btrfs_device_io_align(leaf, dev_item);
device->io_width = btrfs_device_io_width(leaf, dev_item);
device->sector_size = btrfs_device_sector_size(leaf, dev_item);
@@ -66,8 +66,8 @@ struct btrfs_device {
/* minimal io size for this device */
u32 sector_size;
- /* type and info about this device */
- u64 type;
+ /* device flags (e.g. allocation hint) */
+ u64 flags;
/* physical drive uuid (or lvm uuid) */
u8 uuid[BTRFS_UUID_SIZE];
@@ -445,7 +445,7 @@ int make_btrfs(int fd, struct btrfs_mkfs_config *cfg)
btrfs_set_device_io_align(buf, dev_item, cfg->sectorsize);
btrfs_set_device_io_width(buf, dev_item, cfg->sectorsize);
btrfs_set_device_sector_size(buf, dev_item, cfg->sectorsize);
- btrfs_set_device_type(buf, dev_item, 0);
+ btrfs_set_device_flags(buf, dev_item, 0);
write_extent_buffer(buf, super.dev_item.uuid,
(unsigned long)btrfs_device_uuid(dev_item),