diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-01-09 15:55:33 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:59 -0400 |
commit | 55c69072d6bd5be170a85467f64a20963cddf490 (patch) | |
tree | 92f9f34c5d3a19df2bbfc662386ccd690a5f39fb /fs/btrfs/extent-tree.c | |
parent | 21ad10cf3e9c1ef42e725e5c3a593c49f779a16b (diff) |
Btrfs: Fix extent_buffer usage when nodesize != leafsize
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 99a8b0f0d318..2c569b4d59d4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1212,6 +1212,7 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, | |||
1212 | u64 header_transid = | 1212 | u64 header_transid = |
1213 | btrfs_header_generation(buf); | 1213 | btrfs_header_generation(buf); |
1214 | if (header_transid == transid) { | 1214 | if (header_transid == transid) { |
1215 | clean_tree_block(NULL, root, buf); | ||
1215 | free_extent_buffer(buf); | 1216 | free_extent_buffer(buf); |
1216 | return 1; | 1217 | return 1; |
1217 | } | 1218 | } |
@@ -1249,7 +1250,6 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1249 | key.objectid = bytenr; | 1250 | key.objectid = bytenr; |
1250 | btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY); | 1251 | btrfs_set_key_type(&key, BTRFS_EXTENT_ITEM_KEY); |
1251 | key.offset = num_bytes; | 1252 | key.offset = num_bytes; |
1252 | |||
1253 | path = btrfs_alloc_path(); | 1253 | path = btrfs_alloc_path(); |
1254 | if (!path) | 1254 | if (!path) |
1255 | return -ENOMEM; | 1255 | return -ENOMEM; |
@@ -1648,8 +1648,6 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, | |||
1648 | search_start, search_end, hint_byte, ins, | 1648 | search_start, search_end, hint_byte, ins, |
1649 | trans->alloc_exclude_start, | 1649 | trans->alloc_exclude_start, |
1650 | trans->alloc_exclude_nr, data); | 1650 | trans->alloc_exclude_nr, data); |
1651 | if (ret) | ||
1652 | printk("find free extent returns %d\n", ret); | ||
1653 | BUG_ON(ret); | 1651 | BUG_ON(ret); |
1654 | if (ret) | 1652 | if (ret) |
1655 | return ret; | 1653 | return ret; |
@@ -1764,7 +1762,16 @@ struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
1764 | 0, 0, 0); | 1762 | 0, 0, 0); |
1765 | return ERR_PTR(-ENOMEM); | 1763 | return ERR_PTR(-ENOMEM); |
1766 | } | 1764 | } |
1765 | btrfs_set_header_generation(buf, trans->transid); | ||
1766 | clean_tree_block(trans, root, buf); | ||
1767 | wait_on_tree_block_writeback(root, buf); | ||
1767 | btrfs_set_buffer_uptodate(buf); | 1768 | btrfs_set_buffer_uptodate(buf); |
1769 | |||
1770 | if (PageDirty(buf->first_page)) { | ||
1771 | printk("page %lu dirty\n", buf->first_page->index); | ||
1772 | WARN_ON(1); | ||
1773 | } | ||
1774 | |||
1768 | set_extent_dirty(&trans->transaction->dirty_pages, buf->start, | 1775 | set_extent_dirty(&trans->transaction->dirty_pages, buf->start, |
1769 | buf->start + buf->len - 1, GFP_NOFS); | 1776 | buf->start + buf->len - 1, GFP_NOFS); |
1770 | set_extent_bits(&BTRFS_I(root->fs_info->btree_inode)->extent_tree, | 1777 | set_extent_bits(&BTRFS_I(root->fs_info->btree_inode)->extent_tree, |