aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-01-09 15:55:33 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:59 -0400
commit55c69072d6bd5be170a85467f64a20963cddf490 (patch)
tree92f9f34c5d3a19df2bbfc662386ccd690a5f39fb /fs/btrfs/disk-io.c
parent21ad10cf3e9c1ef42e725e5c3a593c49f779a16b (diff)
Btrfs: Fix extent_buffer usage when nodesize != leafsize
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a481b970608c..0338f8fd382d 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -197,9 +197,23 @@ int csum_dirty_buffer(struct btrfs_root *root, struct page *page)
197 if (found_start != start) { 197 if (found_start != start) {
198 printk("warning: eb start incorrect %Lu buffer %Lu len %lu\n", 198 printk("warning: eb start incorrect %Lu buffer %Lu len %lu\n",
199 start, found_start, len); 199 start, found_start, len);
200 WARN_ON(1);
201 goto err;
202 }
203 if (eb->first_page != page) {
204 printk("bad first page %lu %lu\n", eb->first_page->index,
205 page->index);
206 WARN_ON(1);
207 goto err;
208 }
209 if (!PageUptodate(page)) {
210 printk("csum not up to date page %lu\n", page->index);
211 WARN_ON(1);
212 goto err;
200 } 213 }
201 found_level = btrfs_header_level(eb); 214 found_level = btrfs_header_level(eb);
202 csum_tree_block(root, eb, 0); 215 csum_tree_block(root, eb, 0);
216err:
203 free_extent_buffer(eb); 217 free_extent_buffer(eb);
204out: 218out:
205 return 0; 219 return 0;
@@ -368,7 +382,10 @@ int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
368 struct extent_buffer *buf) 382 struct extent_buffer *buf)
369{ 383{
370 struct inode *btree_inode = root->fs_info->btree_inode; 384 struct inode *btree_inode = root->fs_info->btree_inode;
371 clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf); 385 if (btrfs_header_generation(buf) ==
386 root->fs_info->running_transaction->transid)
387 clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree,
388 buf);
372 return 0; 389 return 0;
373} 390}
374 391
@@ -897,8 +914,11 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
897 914
898void btrfs_throttle(struct btrfs_root *root) 915void btrfs_throttle(struct btrfs_root *root)
899{ 916{
900 if (root->fs_info->throttles) 917 struct backing_dev_info *bdi;
901 congestion_wait(WRITE, HZ/10); 918
919 bdi = root->fs_info->sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
920 if (root->fs_info->throttles && bdi_write_congested(bdi))
921 congestion_wait(WRITE, HZ/20);
902} 922}
903 923
904void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr) 924void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)