summaryrefslogtreecommitdiff
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)
downloadlwn-55c69072d6bd5be170a85467f64a20963cddf490.tar.gz
lwn-55c69072d6bd5be170a85467f64a20963cddf490.zip
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)
if (found_start != start) {
printk("warning: eb start incorrect %Lu buffer %Lu len %lu\n",
start, found_start, len);
+ WARN_ON(1);
+ goto err;
+ }
+ if (eb->first_page != page) {
+ printk("bad first page %lu %lu\n", eb->first_page->index,
+ page->index);
+ WARN_ON(1);
+ goto err;
+ }
+ if (!PageUptodate(page)) {
+ printk("csum not up to date page %lu\n", page->index);
+ WARN_ON(1);
+ goto err;
}
found_level = btrfs_header_level(eb);
csum_tree_block(root, eb, 0);
+err:
free_extent_buffer(eb);
out:
return 0;
@@ -368,7 +382,10 @@ int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct extent_buffer *buf)
{
struct inode *btree_inode = root->fs_info->btree_inode;
- clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree, buf);
+ if (btrfs_header_generation(buf) ==
+ root->fs_info->running_transaction->transid)
+ clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->extent_tree,
+ buf);
return 0;
}
@@ -897,8 +914,11 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
void btrfs_throttle(struct btrfs_root *root)
{
- if (root->fs_info->throttles)
- congestion_wait(WRITE, HZ/10);
+ struct backing_dev_info *bdi;
+
+ bdi = root->fs_info->sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
+ if (root->fs_info->throttles && bdi_write_congested(bdi))
+ congestion_wait(WRITE, HZ/20);
}
void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr)