aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-06-28 15:57:36 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-06-28 15:57:36 -0400
commitccd467d60e81b48cdbecae93532b66bcdedca91d (patch)
tree7c8c74ca8c6c058fc2e3c90c0082e796b7c1e92e /fs/btrfs/disk-io.c
parentf2654de42a759127cb1f1e8a626ec94178732e20 (diff)
Btrfs: crash recovery fixes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 7081729d5b16..d1bf5bc1bc14 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -270,14 +270,6 @@ fail:
270 return NULL; 270 return NULL;
271} 271}
272 272
273int dirty_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
274 struct buffer_head *buf)
275{
276 WARN_ON(atomic_read(&buf->b_count) == 0);
277 mark_buffer_dirty(buf);
278 return 0;
279}
280
281int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, 273int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
282 struct buffer_head *buf) 274 struct buffer_head *buf)
283{ 275{
@@ -621,6 +613,20 @@ int close_ctree(struct btrfs_root *root)
621 return 0; 613 return 0;
622} 614}
623 615
616void btrfs_mark_buffer_dirty(struct buffer_head *bh)
617{
618 struct btrfs_root *root = BTRFS_I(bh->b_page->mapping->host)->root;
619 u64 transid = btrfs_header_generation(btrfs_buffer_header(bh));
620 WARN_ON(!atomic_read(&bh->b_count));
621 if (transid != root->fs_info->generation) {
622 printk(KERN_CRIT "transid mismatch buffer %llu, found %Lu running %Lu\n",
623 (unsigned long long)bh->b_blocknr,
624 transid, root->fs_info->generation);
625 WARN_ON(1);
626 }
627 mark_buffer_dirty(bh);
628}
629
624void btrfs_block_release(struct btrfs_root *root, struct buffer_head *buf) 630void btrfs_block_release(struct btrfs_root *root, struct buffer_head *buf)
625{ 631{
626 brelse(buf); 632 brelse(buf);