diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-04-02 14:53:59 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-04-02 14:53:59 -0400 |
commit | 7cfcc17e7f2334a0503331264c1340de4e564c85 (patch) | |
tree | 4ce6ac8520382673006845ec20b2ad83abc9258a /fs/btrfs/disk-io.c | |
parent | 5caf2a002901f0fde475371c4bf1c553b51884af (diff) |
Btrfs: corruptions fixed
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 2dbd55084a4e..a227e94b9e88 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -23,8 +23,6 @@ static int check_tree_block(struct btrfs_root *root, struct buffer_head *buf) | |||
23 | 23 | ||
24 | struct buffer_head *btrfs_find_tree_block(struct btrfs_root *root, u64 blocknr) | 24 | struct buffer_head *btrfs_find_tree_block(struct btrfs_root *root, u64 blocknr) |
25 | { | 25 | { |
26 | return sb_find_get_block(root->fs_info->sb, blocknr); | ||
27 | #if 0 | ||
28 | struct address_space *mapping = root->fs_info->btree_inode->i_mapping; | 26 | struct address_space *mapping = root->fs_info->btree_inode->i_mapping; |
29 | int blockbits = root->fs_info->sb->s_blocksize_bits; | 27 | int blockbits = root->fs_info->sb->s_blocksize_bits; |
30 | unsigned long index = blocknr >> (PAGE_CACHE_SHIFT - blockbits); | 28 | unsigned long index = blocknr >> (PAGE_CACHE_SHIFT - blockbits); |
@@ -58,14 +56,11 @@ out_unlock: | |||
58 | } | 56 | } |
59 | page_cache_release(page); | 57 | page_cache_release(page); |
60 | return ret; | 58 | return ret; |
61 | #endif | ||
62 | } | 59 | } |
63 | 60 | ||
64 | struct buffer_head *btrfs_find_create_tree_block(struct btrfs_root *root, | 61 | struct buffer_head *btrfs_find_create_tree_block(struct btrfs_root *root, |
65 | u64 blocknr) | 62 | u64 blocknr) |
66 | { | 63 | { |
67 | return sb_getblk(root->fs_info->sb, blocknr); | ||
68 | #if 0 | ||
69 | struct address_space *mapping = root->fs_info->btree_inode->i_mapping; | 64 | struct address_space *mapping = root->fs_info->btree_inode->i_mapping; |
70 | int blockbits = root->fs_info->sb->s_blocksize_bits; | 65 | int blockbits = root->fs_info->sb->s_blocksize_bits; |
71 | unsigned long index = blocknr >> (PAGE_CACHE_SHIFT - blockbits); | 66 | unsigned long index = blocknr >> (PAGE_CACHE_SHIFT - blockbits); |
@@ -103,7 +98,6 @@ out_unlock: | |||
103 | touch_buffer(ret); | 98 | touch_buffer(ret); |
104 | page_cache_release(page); | 99 | page_cache_release(page); |
105 | return ret; | 100 | return ret; |
106 | #endif | ||
107 | } | 101 | } |
108 | 102 | ||
109 | static sector_t max_block(struct block_device *bdev) | 103 | static sector_t max_block(struct block_device *bdev) |
@@ -186,7 +180,6 @@ static int csum_tree_block(struct btrfs_root *root, struct buffer_head *bh, | |||
186 | 180 | ||
187 | static int btree_writepage(struct page *page, struct writeback_control *wbc) | 181 | static int btree_writepage(struct page *page, struct writeback_control *wbc) |
188 | { | 182 | { |
189 | #if 0 | ||
190 | struct buffer_head *bh; | 183 | struct buffer_head *bh; |
191 | struct btrfs_root *root = btrfs_sb(page->mapping->host->i_sb); | 184 | struct btrfs_root *root = btrfs_sb(page->mapping->host->i_sb); |
192 | struct buffer_head *head; | 185 | struct buffer_head *head; |
@@ -201,7 +194,6 @@ static int btree_writepage(struct page *page, struct writeback_control *wbc) | |||
201 | csum_tree_block(root, bh, 0); | 194 | csum_tree_block(root, bh, 0); |
202 | bh = bh->b_this_page; | 195 | bh = bh->b_this_page; |
203 | } while (bh != head); | 196 | } while (bh != head); |
204 | #endif | ||
205 | return block_write_full_page(page, btree_get_block, wbc); | 197 | return block_write_full_page(page, btree_get_block, wbc); |
206 | } | 198 | } |
207 | 199 | ||
@@ -218,8 +210,6 @@ static struct address_space_operations btree_aops = { | |||
218 | 210 | ||
219 | struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr) | 211 | struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr) |
220 | { | 212 | { |
221 | return sb_bread(root->fs_info->sb, blocknr); | ||
222 | #if 0 | ||
223 | struct buffer_head *bh = NULL; | 213 | struct buffer_head *bh = NULL; |
224 | 214 | ||
225 | bh = btrfs_find_create_tree_block(root, blocknr); | 215 | bh = btrfs_find_create_tree_block(root, blocknr); |
@@ -243,8 +233,6 @@ struct buffer_head *read_tree_block(struct btrfs_root *root, u64 blocknr) | |||
243 | fail: | 233 | fail: |
244 | brelse(bh); | 234 | brelse(bh); |
245 | return NULL; | 235 | return NULL; |
246 | |||
247 | #endif | ||
248 | } | 236 | } |
249 | 237 | ||
250 | int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 238 | int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
@@ -323,8 +311,6 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
323 | fs_info->last_inode_alloc = 0; | 311 | fs_info->last_inode_alloc = 0; |
324 | fs_info->last_inode_alloc_dirid = 0; | 312 | fs_info->last_inode_alloc_dirid = 0; |
325 | fs_info->sb = sb; | 313 | fs_info->sb = sb; |
326 | fs_info->btree_inode = NULL; | ||
327 | #if 0 | ||
328 | fs_info->btree_inode = new_inode(sb); | 314 | fs_info->btree_inode = new_inode(sb); |
329 | fs_info->btree_inode->i_ino = 1; | 315 | fs_info->btree_inode->i_ino = 1; |
330 | fs_info->btree_inode->i_nlink = 1; | 316 | fs_info->btree_inode->i_nlink = 1; |
@@ -332,7 +318,6 @@ struct btrfs_root *open_ctree(struct super_block *sb) | |||
332 | fs_info->btree_inode->i_mapping->a_ops = &btree_aops; | 318 | fs_info->btree_inode->i_mapping->a_ops = &btree_aops; |
333 | insert_inode_hash(fs_info->btree_inode); | 319 | insert_inode_hash(fs_info->btree_inode); |
334 | mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS); | 320 | mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS); |
335 | #endif | ||
336 | fs_info->hash_tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); | 321 | fs_info->hash_tfm = crypto_alloc_hash("sha256", 0, CRYPTO_ALG_ASYNC); |
337 | spin_lock_init(&fs_info->hash_lock); | 322 | spin_lock_init(&fs_info->hash_lock); |
338 | if (!fs_info->hash_tfm || IS_ERR(fs_info->hash_tfm)) { | 323 | if (!fs_info->hash_tfm || IS_ERR(fs_info->hash_tfm)) { |
@@ -435,8 +420,8 @@ int close_ctree(struct btrfs_root *root) | |||
435 | btrfs_block_release(root, root->commit_root); | 420 | btrfs_block_release(root, root->commit_root); |
436 | btrfs_block_release(root, root->fs_info->sb_buffer); | 421 | btrfs_block_release(root, root->fs_info->sb_buffer); |
437 | crypto_free_hash(root->fs_info->hash_tfm); | 422 | crypto_free_hash(root->fs_info->hash_tfm); |
438 | // truncate_inode_pages(root->fs_info->btree_inode->i_mapping, 0); | 423 | truncate_inode_pages(root->fs_info->btree_inode->i_mapping, 0); |
439 | // iput(root->fs_info->btree_inode); | 424 | iput(root->fs_info->btree_inode); |
440 | kfree(root->fs_info->extent_root); | 425 | kfree(root->fs_info->extent_root); |
441 | kfree(root->fs_info->inode_root); | 426 | kfree(root->fs_info->inode_root); |
442 | kfree(root->fs_info->tree_root); | 427 | kfree(root->fs_info->tree_root); |
@@ -447,6 +432,6 @@ int close_ctree(struct btrfs_root *root) | |||
447 | 432 | ||
448 | void btrfs_block_release(struct btrfs_root *root, struct buffer_head *buf) | 433 | void btrfs_block_release(struct btrfs_root *root, struct buffer_head *buf) |
449 | { | 434 | { |
450 | // brelse(buf); | 435 | brelse(buf); |
451 | } | 436 | } |
452 | 437 | ||