Btrfs: add a device id to device items
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 454eb88..ef3583c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -91,10 +91,12 @@
__le64 total_blocks;
__le64 blocks_used;
__le64 root_dir_objectid;
+ __le64 last_device_id;
/* fields below here vary with the underlying disk */
__le64 device_block_start;
__le64 device_num_blocks;
__le64 device_root;
+ __le64 device_id;
} __attribute__ ((__packed__));
/*
@@ -230,6 +232,7 @@
struct btrfs_device_item {
__le16 pathlen;
+ __le64 device_id;
} __attribute__ ((__packed__));
struct crypto_hash;
@@ -798,6 +801,28 @@
s->root_dir_objectid = cpu_to_le64(val);
}
+static inline u64 btrfs_super_last_device_id(struct btrfs_super_block *s)
+{
+ return le64_to_cpu(s->last_device_id);
+}
+
+static inline void btrfs_set_super_last_device_id(struct btrfs_super_block *s,
+ u64 val)
+{
+ s->last_device_id = cpu_to_le64(val);
+}
+
+static inline u64 btrfs_super_device_id(struct btrfs_super_block *s)
+{
+ return le64_to_cpu(s->device_id);
+}
+
+static inline void btrfs_set_super_device_id(struct btrfs_super_block *s,
+ u64 val)
+{
+ s->device_id = cpu_to_le64(val);
+}
+
static inline u64 btrfs_super_device_block_start(struct btrfs_super_block *s)
{
return le64_to_cpu(s->device_block_start);
@@ -910,6 +935,17 @@
d->pathlen = cpu_to_le16(val);
}
+static inline u64 btrfs_device_id(struct btrfs_device_item *d)
+{
+ return le64_to_cpu(d->device_id);
+}
+
+static inline void btrfs_set_device_id(struct btrfs_device_item *d,
+ u64 val)
+{
+ d->device_id = cpu_to_le64(val);
+}
+
static inline struct btrfs_root *btrfs_sb(struct super_block *sb)
{
return sb->s_fs_info;