diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 1c5e097a4df2..709e33d08bb5 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -159,17 +159,19 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, | |||
159 | from_this_trans = 1; | 159 | from_this_trans = 1; |
160 | 160 | ||
161 | /* FIXME, this is not good */ | 161 | /* FIXME, this is not good */ |
162 | if (from_this_trans == 0 && | 162 | if (memcmp_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE)) { |
163 | memcmp_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE)) { | ||
164 | u32 val; | 163 | u32 val; |
165 | u32 found = 0; | 164 | u32 found = 0; |
166 | memcpy(&found, result, BTRFS_CRC32_SIZE); | 165 | memcpy(&found, result, BTRFS_CRC32_SIZE); |
167 | 166 | ||
168 | read_extent_buffer(buf, &val, 0, BTRFS_CRC32_SIZE); | 167 | read_extent_buffer(buf, &val, 0, BTRFS_CRC32_SIZE); |
168 | WARN_ON(1); | ||
169 | printk("btrfs: %s checksum verify failed on %llu " | 169 | printk("btrfs: %s checksum verify failed on %llu " |
170 | "wanted %X found %X from_this_trans %d\n", | 170 | "wanted %X found %X from_this_trans %d " |
171 | "level %d\n", | ||
171 | root->fs_info->sb->s_id, | 172 | root->fs_info->sb->s_id, |
172 | buf->start, val, found, from_this_trans); | 173 | buf->start, val, found, from_this_trans, |
174 | btrfs_header_level(buf)); | ||
173 | return 1; | 175 | return 1; |
174 | } | 176 | } |
175 | } else { | 177 | } else { |
@@ -220,6 +222,9 @@ int csum_dirty_buffer(struct btrfs_root *root, struct page *page) | |||
220 | goto err; | 222 | goto err; |
221 | } | 223 | } |
222 | found_level = btrfs_header_level(eb); | 224 | found_level = btrfs_header_level(eb); |
225 | spin_lock(&root->fs_info->hash_lock); | ||
226 | btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); | ||
227 | spin_unlock(&root->fs_info->hash_lock); | ||
223 | csum_tree_block(root, eb, 0); | 228 | csum_tree_block(root, eb, 0); |
224 | err: | 229 | err: |
225 | free_extent_buffer(eb); | 230 | free_extent_buffer(eb); |