diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2008-12-08 16:46:26 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-12-08 16:46:26 -0500 |
commit | a512bbf855ff0af474257475f2e6da7acd854f52 (patch) | |
tree | 1b2cfcf4152e09f32a6cb0bcbd798d5dab2f5490 /fs/btrfs/disk-io.h | |
parent | d20f7043fa65659136c1a7c3c456eeeb5c6f431f (diff) |
Btrfs: superblock duplication
This patch implements superblock duplication. Superblocks
are stored at offset 16K, 64M and 256G on every devices.
Spaces used by superblocks are preserved by the allocator,
which uses a reverse mapping function to find the logical
addresses that correspond to superblocks. Thank you,
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.h')
-rw-r--r-- | fs/btrfs/disk-io.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 717e94811e4e..c0ff404c31b7 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -19,8 +19,20 @@ | |||
19 | #ifndef __DISKIO__ | 19 | #ifndef __DISKIO__ |
20 | #define __DISKIO__ | 20 | #define __DISKIO__ |
21 | 21 | ||
22 | #define BTRFS_SUPER_INFO_OFFSET (16 * 1024) | 22 | #define BTRFS_SUPER_INFO_OFFSET (64 * 1024) |
23 | #define BTRFS_SUPER_INFO_SIZE 4096 | 23 | #define BTRFS_SUPER_INFO_SIZE 4096 |
24 | |||
25 | #define BTRFS_SUPER_MIRROR_MAX 3 | ||
26 | #define BTRFS_SUPER_MIRROR_SHIFT 12 | ||
27 | |||
28 | static inline u64 btrfs_sb_offset(int mirror) | ||
29 | { | ||
30 | u64 start = 16 * 1024; | ||
31 | if (mirror) | ||
32 | return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror); | ||
33 | return BTRFS_SUPER_INFO_OFFSET; | ||
34 | } | ||
35 | |||
24 | struct btrfs_device; | 36 | struct btrfs_device; |
25 | struct btrfs_fs_devices; | 37 | struct btrfs_fs_devices; |
26 | 38 | ||
@@ -37,7 +49,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
37 | char *options); | 49 | char *options); |
38 | int close_ctree(struct btrfs_root *root); | 50 | int close_ctree(struct btrfs_root *root); |
39 | int write_ctree_super(struct btrfs_trans_handle *trans, | 51 | int write_ctree_super(struct btrfs_trans_handle *trans, |
40 | struct btrfs_root *root); | 52 | struct btrfs_root *root, int max_mirrors); |
53 | struct buffer_head *btrfs_read_dev_super(struct block_device *bdev); | ||
41 | int btrfs_commit_super(struct btrfs_root *root); | 54 | int btrfs_commit_super(struct btrfs_root *root); |
42 | struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, | 55 | struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, |
43 | u64 bytenr, u32 blocksize); | 56 | u64 bytenr, u32 blocksize); |