disk-io.c (1cb048f596cc7b4405d695d65ca70098a7ab9065) | disk-io.c (c1c9ff7c94e83fae89a742df74db51156869bad5) |
---|---|
1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 289 unchanged lines hidden (view full) --- 298 u32 val; 299 u32 found = 0; 300 memcpy(&found, result, csum_size); 301 302 read_extent_buffer(buf, &val, 0, csum_size); 303 printk_ratelimited(KERN_INFO "btrfs: %s checksum verify " 304 "failed on %llu wanted %X found %X " 305 "level %d\n", | 1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 289 unchanged lines hidden (view full) --- 298 u32 val; 299 u32 found = 0; 300 memcpy(&found, result, csum_size); 301 302 read_extent_buffer(buf, &val, 0, csum_size); 303 printk_ratelimited(KERN_INFO "btrfs: %s checksum verify " 304 "failed on %llu wanted %X found %X " 305 "level %d\n", |
306 root->fs_info->sb->s_id, 307 (unsigned long long)buf->start, val, found, 308 btrfs_header_level(buf)); | 306 root->fs_info->sb->s_id, buf->start, 307 val, found, btrfs_header_level(buf)); |
309 if (result != (char *)&inline_result) 310 kfree(result); 311 return 1; 312 } 313 } else { 314 write_extent_buffer(buf, result, 0, csum_size); 315 } 316 if (result != (char *)&inline_result) --- 24 unchanged lines hidden (view full) --- 341 0, &cached_state); 342 if (extent_buffer_uptodate(eb) && 343 btrfs_header_generation(eb) == parent_transid) { 344 ret = 0; 345 goto out; 346 } 347 printk_ratelimited("parent transid verify failed on %llu wanted %llu " 348 "found %llu\n", | 308 if (result != (char *)&inline_result) 309 kfree(result); 310 return 1; 311 } 312 } else { 313 write_extent_buffer(buf, result, 0, csum_size); 314 } 315 if (result != (char *)&inline_result) --- 24 unchanged lines hidden (view full) --- 340 0, &cached_state); 341 if (extent_buffer_uptodate(eb) && 342 btrfs_header_generation(eb) == parent_transid) { 343 ret = 0; 344 goto out; 345 } 346 printk_ratelimited("parent transid verify failed on %llu wanted %llu " 347 "found %llu\n", |
349 (unsigned long long)eb->start, 350 (unsigned long long)parent_transid, 351 (unsigned long long)btrfs_header_generation(eb)); | 348 eb->start, parent_transid, btrfs_header_generation(eb)); |
352 ret = 1; 353 clear_extent_buffer_uptodate(eb); 354out: 355 unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, 356 &cached_state, GFP_NOFS); 357 return ret; 358} 359 --- 148 unchanged lines hidden (view full) --- 508 fs_devices = fs_devices->seed; 509 } 510 return ret; 511} 512 513#define CORRUPT(reason, eb, root, slot) \ 514 printk(KERN_CRIT "btrfs: corrupt leaf, %s: block=%llu," \ 515 "root=%llu, slot=%d\n", reason, \ | 349 ret = 1; 350 clear_extent_buffer_uptodate(eb); 351out: 352 unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, 353 &cached_state, GFP_NOFS); 354 return ret; 355} 356 --- 148 unchanged lines hidden (view full) --- 505 fs_devices = fs_devices->seed; 506 } 507 return ret; 508} 509 510#define CORRUPT(reason, eb, root, slot) \ 511 printk(KERN_CRIT "btrfs: corrupt leaf, %s: block=%llu," \ 512 "root=%llu, slot=%d\n", reason, \ |
516 (unsigned long long)btrfs_header_bytenr(eb), \ 517 (unsigned long long)root->objectid, slot) | 513 btrfs_header_bytenr(eb), root->objectid, slot) |
518 519static noinline int check_leaf(struct btrfs_root *root, 520 struct extent_buffer *leaf) 521{ 522 struct btrfs_key key; 523 struct btrfs_key leaf_key; 524 u32 nritems = btrfs_header_nritems(leaf); 525 int slot; --- 83 unchanged lines hidden (view full) --- 609 ret = -EIO; 610 goto err; 611 } 612 613 found_start = btrfs_header_bytenr(eb); 614 if (found_start != eb->start) { 615 printk_ratelimited(KERN_INFO "btrfs bad tree block start " 616 "%llu %llu\n", | 514 515static noinline int check_leaf(struct btrfs_root *root, 516 struct extent_buffer *leaf) 517{ 518 struct btrfs_key key; 519 struct btrfs_key leaf_key; 520 u32 nritems = btrfs_header_nritems(leaf); 521 int slot; --- 83 unchanged lines hidden (view full) --- 605 ret = -EIO; 606 goto err; 607 } 608 609 found_start = btrfs_header_bytenr(eb); 610 if (found_start != eb->start) { 611 printk_ratelimited(KERN_INFO "btrfs bad tree block start " 612 "%llu %llu\n", |
617 (unsigned long long)found_start, 618 (unsigned long long)eb->start); | 613 found_start, eb->start); |
619 ret = -EIO; 620 goto err; 621 } 622 if (check_tree_block_fsid(root, eb)) { 623 printk_ratelimited(KERN_INFO "btrfs bad fsid on block %llu\n", | 614 ret = -EIO; 615 goto err; 616 } 617 if (check_tree_block_fsid(root, eb)) { 618 printk_ratelimited(KERN_INFO "btrfs bad fsid on block %llu\n", |
624 (unsigned long long)eb->start); | 619 eb->start); |
625 ret = -EIO; 626 goto err; 627 } 628 found_level = btrfs_header_level(eb); 629 if (found_level >= BTRFS_MAX_LEVEL) { 630 btrfs_info(root->fs_info, "bad tree block level %d\n", 631 (int)btrfs_header_level(eb)); 632 ret = -EIO; --- 1767 unchanged lines hidden (view full) --- 2400 goto fail_alloc; 2401 } 2402 2403 features = btrfs_super_incompat_flags(disk_super) & 2404 ~BTRFS_FEATURE_INCOMPAT_SUPP; 2405 if (features) { 2406 printk(KERN_ERR "BTRFS: couldn't mount because of " 2407 "unsupported optional features (%Lx).\n", | 620 ret = -EIO; 621 goto err; 622 } 623 found_level = btrfs_header_level(eb); 624 if (found_level >= BTRFS_MAX_LEVEL) { 625 btrfs_info(root->fs_info, "bad tree block level %d\n", 626 (int)btrfs_header_level(eb)); 627 ret = -EIO; --- 1767 unchanged lines hidden (view full) --- 2395 goto fail_alloc; 2396 } 2397 2398 features = btrfs_super_incompat_flags(disk_super) & 2399 ~BTRFS_FEATURE_INCOMPAT_SUPP; 2400 if (features) { 2401 printk(KERN_ERR "BTRFS: couldn't mount because of " 2402 "unsupported optional features (%Lx).\n", |
2408 (unsigned long long)features); | 2403 features); |
2409 err = -EINVAL; 2410 goto fail_alloc; 2411 } 2412 2413 if (btrfs_super_leafsize(disk_super) != 2414 btrfs_super_nodesize(disk_super)) { 2415 printk(KERN_ERR "BTRFS: couldn't mount because metadata " 2416 "blocksizes don't match. node %d leaf %d\n", --- 53 unchanged lines hidden (view full) --- 2470 */ 2471 btrfs_set_super_incompat_flags(disk_super, features); 2472 2473 features = btrfs_super_compat_ro_flags(disk_super) & 2474 ~BTRFS_FEATURE_COMPAT_RO_SUPP; 2475 if (!(sb->s_flags & MS_RDONLY) && features) { 2476 printk(KERN_ERR "BTRFS: couldn't mount RDWR because of " 2477 "unsupported option features (%Lx).\n", | 2404 err = -EINVAL; 2405 goto fail_alloc; 2406 } 2407 2408 if (btrfs_super_leafsize(disk_super) != 2409 btrfs_super_nodesize(disk_super)) { 2410 printk(KERN_ERR "BTRFS: couldn't mount because metadata " 2411 "blocksizes don't match. node %d leaf %d\n", --- 53 unchanged lines hidden (view full) --- 2465 */ 2466 btrfs_set_super_incompat_flags(disk_super, features); 2467 2468 features = btrfs_super_compat_ro_flags(disk_super) & 2469 ~BTRFS_FEATURE_COMPAT_RO_SUPP; 2470 if (!(sb->s_flags & MS_RDONLY) && features) { 2471 printk(KERN_ERR "BTRFS: couldn't mount RDWR because of " 2472 "unsupported option features (%Lx).\n", |
2478 (unsigned long long)features); | 2473 features); |
2479 err = -EINVAL; 2480 goto fail_alloc; 2481 } 2482 2483 btrfs_init_workers(&fs_info->generic_worker, 2484 "genwork", 1, NULL); 2485 2486 btrfs_init_workers(&fs_info->workers, "worker", --- 1189 unchanged lines hidden (view full) --- 3676 struct btrfs_root *root = BTRFS_I(buf->pages[0]->mapping->host)->root; 3677 u64 transid = btrfs_header_generation(buf); 3678 int was_dirty; 3679 3680 btrfs_assert_tree_locked(buf); 3681 if (transid != root->fs_info->generation) 3682 WARN(1, KERN_CRIT "btrfs transid mismatch buffer %llu, " 3683 "found %llu running %llu\n", | 2474 err = -EINVAL; 2475 goto fail_alloc; 2476 } 2477 2478 btrfs_init_workers(&fs_info->generic_worker, 2479 "genwork", 1, NULL); 2480 2481 btrfs_init_workers(&fs_info->workers, "worker", --- 1189 unchanged lines hidden (view full) --- 3671 struct btrfs_root *root = BTRFS_I(buf->pages[0]->mapping->host)->root; 3672 u64 transid = btrfs_header_generation(buf); 3673 int was_dirty; 3674 3675 btrfs_assert_tree_locked(buf); 3676 if (transid != root->fs_info->generation) 3677 WARN(1, KERN_CRIT "btrfs transid mismatch buffer %llu, " 3678 "found %llu running %llu\n", |
3684 (unsigned long long)buf->start, 3685 (unsigned long long)transid, 3686 (unsigned long long)root->fs_info->generation); | 3679 buf->start, transid, root->fs_info->generation); |
3687 was_dirty = set_extent_buffer_dirty(buf); 3688 if (!was_dirty) 3689 __percpu_counter_add(&root->fs_info->dirty_metadata_bytes, 3690 buf->len, 3691 root->fs_info->dirty_metadata_batch); 3692} 3693 3694static void __btrfs_btree_balance_dirty(struct btrfs_root *root, --- 442 unchanged lines hidden --- | 3680 was_dirty = set_extent_buffer_dirty(buf); 3681 if (!was_dirty) 3682 __percpu_counter_add(&root->fs_info->dirty_metadata_bytes, 3683 buf->len, 3684 root->fs_info->dirty_metadata_batch); 3685} 3686 3687static void __btrfs_btree_balance_dirty(struct btrfs_root *root, --- 442 unchanged lines hidden --- |