diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-04-12 12:14:00 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-04-12 12:14:00 -0400 |
commit | b4100d64241fed93a3f821ddf59d11ab4443a3ba (patch) | |
tree | 57d3cb2367b5852a9017ec9ff58653338ef45a9f /fs/btrfs/ctree.h | |
parent | 8352d8a473ac84bf7a1c69690b626946d744ca58 (diff) |
Btrfs: add a device id to device items
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 454eb88611bb..ef3583cf74d6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -91,10 +91,12 @@ struct btrfs_super_block { | |||
91 | __le64 total_blocks; | 91 | __le64 total_blocks; |
92 | __le64 blocks_used; | 92 | __le64 blocks_used; |
93 | __le64 root_dir_objectid; | 93 | __le64 root_dir_objectid; |
94 | __le64 last_device_id; | ||
94 | /* fields below here vary with the underlying disk */ | 95 | /* fields below here vary with the underlying disk */ |
95 | __le64 device_block_start; | 96 | __le64 device_block_start; |
96 | __le64 device_num_blocks; | 97 | __le64 device_num_blocks; |
97 | __le64 device_root; | 98 | __le64 device_root; |
99 | __le64 device_id; | ||
98 | } __attribute__ ((__packed__)); | 100 | } __attribute__ ((__packed__)); |
99 | 101 | ||
100 | /* | 102 | /* |
@@ -230,6 +232,7 @@ struct btrfs_csum_item { | |||
230 | 232 | ||
231 | struct btrfs_device_item { | 233 | struct btrfs_device_item { |
232 | __le16 pathlen; | 234 | __le16 pathlen; |
235 | __le64 device_id; | ||
233 | } __attribute__ ((__packed__)); | 236 | } __attribute__ ((__packed__)); |
234 | 237 | ||
235 | struct crypto_hash; | 238 | struct crypto_hash; |
@@ -798,6 +801,28 @@ static inline void btrfs_set_super_root_dir(struct btrfs_super_block *s, u64 | |||
798 | s->root_dir_objectid = cpu_to_le64(val); | 801 | s->root_dir_objectid = cpu_to_le64(val); |
799 | } | 802 | } |
800 | 803 | ||
804 | static inline u64 btrfs_super_last_device_id(struct btrfs_super_block *s) | ||
805 | { | ||
806 | return le64_to_cpu(s->last_device_id); | ||
807 | } | ||
808 | |||
809 | static inline void btrfs_set_super_last_device_id(struct btrfs_super_block *s, | ||
810 | u64 val) | ||
811 | { | ||
812 | s->last_device_id = cpu_to_le64(val); | ||
813 | } | ||
814 | |||
815 | static inline u64 btrfs_super_device_id(struct btrfs_super_block *s) | ||
816 | { | ||
817 | return le64_to_cpu(s->device_id); | ||
818 | } | ||
819 | |||
820 | static inline void btrfs_set_super_device_id(struct btrfs_super_block *s, | ||
821 | u64 val) | ||
822 | { | ||
823 | s->device_id = cpu_to_le64(val); | ||
824 | } | ||
825 | |||
801 | static inline u64 btrfs_super_device_block_start(struct btrfs_super_block *s) | 826 | static inline u64 btrfs_super_device_block_start(struct btrfs_super_block *s) |
802 | { | 827 | { |
803 | return le64_to_cpu(s->device_block_start); | 828 | return le64_to_cpu(s->device_block_start); |
@@ -910,6 +935,17 @@ static inline void btrfs_set_device_pathlen(struct btrfs_device_item *d, | |||
910 | d->pathlen = cpu_to_le16(val); | 935 | d->pathlen = cpu_to_le16(val); |
911 | } | 936 | } |
912 | 937 | ||
938 | static inline u64 btrfs_device_id(struct btrfs_device_item *d) | ||
939 | { | ||
940 | return le64_to_cpu(d->device_id); | ||
941 | } | ||
942 | |||
943 | static inline void btrfs_set_device_id(struct btrfs_device_item *d, | ||
944 | u64 val) | ||
945 | { | ||
946 | d->device_id = cpu_to_le64(val); | ||
947 | } | ||
948 | |||
913 | static inline struct btrfs_root *btrfs_sb(struct super_block *sb) | 949 | static inline struct btrfs_root *btrfs_sb(struct super_block *sb) |
914 | { | 950 | { |
915 | return sb->s_fs_info; | 951 | return sb->s_fs_info; |