aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-18 14:17:20 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:02 -0400
commit0afbaf8c8216a0de64b55c2d455de2b6c9dde5eb (patch)
treef6797a056e249e715b777649dc6b81443d7ac951 /fs
parenta40a90a0420abd5ff86a0917facd3293ebb6a9b6 (diff)
Btrfs: Set the btree inode i_size to OFFSET_MAX
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 2de2b00afebc..9d648f2f41a5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -88,19 +88,35 @@ struct extent_map *btree_get_extent(struct inode *inode, struct page *page,
88 goto out; 88 goto out;
89 } 89 }
90 em->start = 0; 90 em->start = 0;
91 em->len = i_size_read(inode); 91 em->len = (u64)-1;
92 em->block_start = 0; 92 em->block_start = 0;
93 em->bdev = inode->i_sb->s_bdev; 93 em->bdev = inode->i_sb->s_bdev;
94 94
95 spin_lock(&em_tree->lock); 95 spin_lock(&em_tree->lock);
96 ret = add_extent_mapping(em_tree, em); 96 ret = add_extent_mapping(em_tree, em);
97 if (ret == -EEXIST) { 97 if (ret == -EEXIST) {
98 u64 failed_start = em->start;
99 u64 failed_len = em->len;
100
101 printk("failed to insert %Lu %Lu -> %Lu into tree\n",
102 em->start, em->len, em->block_start);
98 free_extent_map(em); 103 free_extent_map(em);
99 em = lookup_extent_mapping(em_tree, start, len); 104 em = lookup_extent_mapping(em_tree, start, len);
100 if (em) 105 if (em) {
106 printk("after failing, found %Lu %Lu %Lu\n",
107 em->start, em->len, em->block_start);
101 ret = 0; 108 ret = 0;
102 else 109 } else {
110 em = lookup_extent_mapping(em_tree, failed_start,
111 failed_len);
112 if (em) {
113 printk("double failure lookup gives us "
114 "%Lu %Lu -> %Lu\n", em->start,
115 em->len, em->block_start);
116 free_extent_map(em);
117 }
103 ret = -EIO; 118 ret = -EIO;
119 }
104 } else if (ret) { 120 } else if (ret) {
105 free_extent_map(em); 121 free_extent_map(em);
106 em = NULL; 122 em = NULL;
@@ -1108,7 +1124,13 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1108 fs_info->btree_inode = new_inode(sb); 1124 fs_info->btree_inode = new_inode(sb);
1109 fs_info->btree_inode->i_ino = 1; 1125 fs_info->btree_inode->i_ino = 1;
1110 fs_info->btree_inode->i_nlink = 1; 1126 fs_info->btree_inode->i_nlink = 1;
1111 fs_info->btree_inode->i_size = sb->s_bdev->bd_inode->i_size; 1127
1128 /*
1129 * we set the i_size on the btree inode to the max possible int.
1130 * the real end of the address space is determined by all of
1131 * the devices in the system
1132 */
1133 fs_info->btree_inode->i_size = OFFSET_MAX;
1112 fs_info->btree_inode->i_mapping->a_ops = &btree_aops; 1134 fs_info->btree_inode->i_mapping->a_ops = &btree_aops;
1113 fs_info->btree_inode->i_mapping->backing_dev_info = &fs_info->bdi; 1135 fs_info->btree_inode->i_mapping->backing_dev_info = &fs_info->bdi;
1114 1136
@@ -1196,9 +1218,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1196 tree_root->stripesize = stripesize; 1218 tree_root->stripesize = stripesize;
1197 sb_set_blocksize(sb, sectorsize); 1219 sb_set_blocksize(sb, sectorsize);
1198 1220
1199 i_size_write(fs_info->btree_inode,
1200 btrfs_super_total_bytes(disk_super));
1201
1202 if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC, 1221 if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
1203 sizeof(disk_super->magic))) { 1222 sizeof(disk_super->magic))) {
1204 printk("btrfs: valid FS not found on %s\n", sb->s_id); 1223 printk("btrfs: valid FS not found on %s\n", sb->s_id);