Btrfs: add a device id to device items
authorChris Mason <chris.mason@oracle.com>
Thu, 12 Apr 2007 16:14:00 +0000 (12:14 -0400)
committerDavid Woodhouse <dwmw2@hera.kernel.org>
Thu, 12 Apr 2007 16:14:00 +0000 (12:14 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/super.c

index 454eb88..ef3583c 100644 (file)
@@ -91,10 +91,12 @@ struct btrfs_super_block {
        __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_csum_item {
 
 struct btrfs_device_item {
        __le16 pathlen;
+       __le64 device_id;
 } __attribute__ ((__packed__));
 
 struct crypto_hash;
@@ -798,6 +801,28 @@ static inline void btrfs_set_super_root_dir(struct btrfs_super_block *s, u64
        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 @@ static inline void btrfs_set_device_pathlen(struct btrfs_device_item *d,
        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;
Simple merge
Simple merge
Simple merge