diff options
| -rw-r--r-- | fs/btrfs/backref.c | 23 | ||||
| -rw-r--r-- | fs/btrfs/check-integrity.c | 105 | ||||
| -rw-r--r-- | fs/btrfs/ctree.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/ctree.h | 7 | ||||
| -rw-r--r-- | fs/btrfs/delayed-inode.c | 7 | ||||
| -rw-r--r-- | fs/btrfs/disk-io.c | 3 | ||||
| -rw-r--r-- | fs/btrfs/disk-io.h | 4 | ||||
| -rw-r--r-- | fs/btrfs/extent-tree.c | 27 | ||||
| -rw-r--r-- | fs/btrfs/extent_io.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/free-space-cache.c | 24 | ||||
| -rw-r--r-- | fs/btrfs/inode-map.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 28 | ||||
| -rw-r--r-- | fs/btrfs/ioctl.c | 23 | ||||
| -rw-r--r-- | fs/btrfs/locking.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/raid56.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/scrub.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/send.h | 4 | ||||
| -rw-r--r-- | fs/btrfs/super.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/tests/extent-io-tests.c | 11 | ||||
| -rw-r--r-- | fs/btrfs/tests/free-space-tests.c | 184 | ||||
| -rw-r--r-- | fs/btrfs/tests/inode-tests.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 15 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 17 | ||||
| -rw-r--r-- | fs/btrfs/volumes.h | 2 |
24 files changed, 195 insertions, 305 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index d453d62ab0c6..08405a3da6b1 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
| @@ -520,13 +520,10 @@ static inline int ref_for_same_block(struct __prelim_ref *ref1, | |||
| 520 | static int __add_missing_keys(struct btrfs_fs_info *fs_info, | 520 | static int __add_missing_keys(struct btrfs_fs_info *fs_info, |
| 521 | struct list_head *head) | 521 | struct list_head *head) |
| 522 | { | 522 | { |
| 523 | struct list_head *pos; | 523 | struct __prelim_ref *ref; |
| 524 | struct extent_buffer *eb; | 524 | struct extent_buffer *eb; |
| 525 | 525 | ||
| 526 | list_for_each(pos, head) { | 526 | list_for_each_entry(ref, head, list) { |
| 527 | struct __prelim_ref *ref; | ||
| 528 | ref = list_entry(pos, struct __prelim_ref, list); | ||
| 529 | |||
| 530 | if (ref->parent) | 527 | if (ref->parent) |
| 531 | continue; | 528 | continue; |
| 532 | if (ref->key_for_search.type) | 529 | if (ref->key_for_search.type) |
| @@ -563,23 +560,15 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info, | |||
| 563 | */ | 560 | */ |
| 564 | static void __merge_refs(struct list_head *head, int mode) | 561 | static void __merge_refs(struct list_head *head, int mode) |
| 565 | { | 562 | { |
| 566 | struct list_head *pos1; | 563 | struct __prelim_ref *ref1; |
| 567 | 564 | ||
| 568 | list_for_each(pos1, head) { | 565 | list_for_each_entry(ref1, head, list) { |
| 569 | struct list_head *n2; | 566 | struct __prelim_ref *ref2 = ref1, *tmp; |
| 570 | struct list_head *pos2; | ||
| 571 | struct __prelim_ref *ref1; | ||
| 572 | 567 | ||
| 573 | ref1 = list_entry(pos1, struct __prelim_ref, list); | 568 | list_for_each_entry_safe_continue(ref2, tmp, head, list) { |
| 574 | |||
| 575 | for (pos2 = pos1->next, n2 = pos2->next; pos2 != head; | ||
| 576 | pos2 = n2, n2 = pos2->next) { | ||
| 577 | struct __prelim_ref *ref2; | ||
| 578 | struct __prelim_ref *xchg; | 569 | struct __prelim_ref *xchg; |
| 579 | struct extent_inode_elem *eie; | 570 | struct extent_inode_elem *eie; |
| 580 | 571 | ||
| 581 | ref2 = list_entry(pos2, struct __prelim_ref, list); | ||
| 582 | |||
| 583 | if (!ref_for_same_block(ref1, ref2)) | 572 | if (!ref_for_same_block(ref1, ref2)) |
| 584 | continue; | 573 | continue; |
| 585 | if (mode == 1) { | 574 | if (mode == 1) { |
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 0340c57bf377..861d472564c1 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
| @@ -531,13 +531,9 @@ static struct btrfsic_block *btrfsic_block_hashtable_lookup( | |||
| 531 | (((unsigned int)(dev_bytenr >> 16)) ^ | 531 | (((unsigned int)(dev_bytenr >> 16)) ^ |
| 532 | ((unsigned int)((uintptr_t)bdev))) & | 532 | ((unsigned int)((uintptr_t)bdev))) & |
| 533 | (BTRFSIC_BLOCK_HASHTABLE_SIZE - 1); | 533 | (BTRFSIC_BLOCK_HASHTABLE_SIZE - 1); |
| 534 | struct list_head *elem; | 534 | struct btrfsic_block *b; |
| 535 | |||
| 536 | list_for_each(elem, h->table + hashval) { | ||
| 537 | struct btrfsic_block *const b = | ||
| 538 | list_entry(elem, struct btrfsic_block, | ||
| 539 | collision_resolving_node); | ||
| 540 | 535 | ||
| 536 | list_for_each_entry(b, h->table + hashval, collision_resolving_node) { | ||
| 541 | if (b->dev_state->bdev == bdev && b->dev_bytenr == dev_bytenr) | 537 | if (b->dev_state->bdev == bdev && b->dev_bytenr == dev_bytenr) |
| 542 | return b; | 538 | return b; |
| 543 | } | 539 | } |
| @@ -588,13 +584,9 @@ static struct btrfsic_block_link *btrfsic_block_link_hashtable_lookup( | |||
| 588 | ((unsigned int)((uintptr_t)bdev_ref_to)) ^ | 584 | ((unsigned int)((uintptr_t)bdev_ref_to)) ^ |
| 589 | ((unsigned int)((uintptr_t)bdev_ref_from))) & | 585 | ((unsigned int)((uintptr_t)bdev_ref_from))) & |
| 590 | (BTRFSIC_BLOCK_LINK_HASHTABLE_SIZE - 1); | 586 | (BTRFSIC_BLOCK_LINK_HASHTABLE_SIZE - 1); |
| 591 | struct list_head *elem; | 587 | struct btrfsic_block_link *l; |
| 592 | |||
| 593 | list_for_each(elem, h->table + hashval) { | ||
| 594 | struct btrfsic_block_link *const l = | ||
| 595 | list_entry(elem, struct btrfsic_block_link, | ||
| 596 | collision_resolving_node); | ||
| 597 | 588 | ||
| 589 | list_for_each_entry(l, h->table + hashval, collision_resolving_node) { | ||
| 598 | BUG_ON(NULL == l->block_ref_to); | 590 | BUG_ON(NULL == l->block_ref_to); |
| 599 | BUG_ON(NULL == l->block_ref_from); | 591 | BUG_ON(NULL == l->block_ref_from); |
| 600 | if (l->block_ref_to->dev_state->bdev == bdev_ref_to && | 592 | if (l->block_ref_to->dev_state->bdev == bdev_ref_to && |
| @@ -639,13 +631,9 @@ static struct btrfsic_dev_state *btrfsic_dev_state_hashtable_lookup( | |||
| 639 | const unsigned int hashval = | 631 | const unsigned int hashval = |
| 640 | (((unsigned int)((uintptr_t)bdev)) & | 632 | (((unsigned int)((uintptr_t)bdev)) & |
| 641 | (BTRFSIC_DEV2STATE_HASHTABLE_SIZE - 1)); | 633 | (BTRFSIC_DEV2STATE_HASHTABLE_SIZE - 1)); |
| 642 | struct list_head *elem; | 634 | struct btrfsic_dev_state *ds; |
| 643 | |||
| 644 | list_for_each(elem, h->table + hashval) { | ||
| 645 | struct btrfsic_dev_state *const ds = | ||
| 646 | list_entry(elem, struct btrfsic_dev_state, | ||
| 647 | collision_resolving_node); | ||
| 648 | 635 | ||
| 636 | list_for_each_entry(ds, h->table + hashval, collision_resolving_node) { | ||
| 649 | if (ds->bdev == bdev) | 637 | if (ds->bdev == bdev) |
| 650 | return ds; | 638 | return ds; |
| 651 | } | 639 | } |
| @@ -1720,29 +1708,20 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
| 1720 | 1708 | ||
| 1721 | static void btrfsic_dump_database(struct btrfsic_state *state) | 1709 | static void btrfsic_dump_database(struct btrfsic_state *state) |
| 1722 | { | 1710 | { |
| 1723 | struct list_head *elem_all; | 1711 | const struct btrfsic_block *b_all; |
| 1724 | 1712 | ||
| 1725 | BUG_ON(NULL == state); | 1713 | BUG_ON(NULL == state); |
| 1726 | 1714 | ||
| 1727 | printk(KERN_INFO "all_blocks_list:\n"); | 1715 | printk(KERN_INFO "all_blocks_list:\n"); |
| 1728 | list_for_each(elem_all, &state->all_blocks_list) { | 1716 | list_for_each_entry(b_all, &state->all_blocks_list, all_blocks_node) { |
| 1729 | const struct btrfsic_block *const b_all = | 1717 | const struct btrfsic_block_link *l; |
| 1730 | list_entry(elem_all, struct btrfsic_block, | ||
| 1731 | all_blocks_node); | ||
| 1732 | struct list_head *elem_ref_to; | ||
| 1733 | struct list_head *elem_ref_from; | ||
| 1734 | 1718 | ||
| 1735 | printk(KERN_INFO "%c-block @%llu (%s/%llu/%d)\n", | 1719 | printk(KERN_INFO "%c-block @%llu (%s/%llu/%d)\n", |
| 1736 | btrfsic_get_block_type(state, b_all), | 1720 | btrfsic_get_block_type(state, b_all), |
| 1737 | b_all->logical_bytenr, b_all->dev_state->name, | 1721 | b_all->logical_bytenr, b_all->dev_state->name, |
| 1738 | b_all->dev_bytenr, b_all->mirror_num); | 1722 | b_all->dev_bytenr, b_all->mirror_num); |
| 1739 | 1723 | ||
| 1740 | list_for_each(elem_ref_to, &b_all->ref_to_list) { | 1724 | list_for_each_entry(l, &b_all->ref_to_list, node_ref_to) { |
| 1741 | const struct btrfsic_block_link *const l = | ||
| 1742 | list_entry(elem_ref_to, | ||
| 1743 | struct btrfsic_block_link, | ||
| 1744 | node_ref_to); | ||
| 1745 | |||
| 1746 | printk(KERN_INFO " %c @%llu (%s/%llu/%d)" | 1725 | printk(KERN_INFO " %c @%llu (%s/%llu/%d)" |
| 1747 | " refers %u* to" | 1726 | " refers %u* to" |
| 1748 | " %c @%llu (%s/%llu/%d)\n", | 1727 | " %c @%llu (%s/%llu/%d)\n", |
| @@ -1757,12 +1736,7 @@ static void btrfsic_dump_database(struct btrfsic_state *state) | |||
| 1757 | l->block_ref_to->mirror_num); | 1736 | l->block_ref_to->mirror_num); |
| 1758 | } | 1737 | } |
| 1759 | 1738 | ||
| 1760 | list_for_each(elem_ref_from, &b_all->ref_from_list) { | 1739 | list_for_each_entry(l, &b_all->ref_from_list, node_ref_from) { |
| 1761 | const struct btrfsic_block_link *const l = | ||
| 1762 | list_entry(elem_ref_from, | ||
| 1763 | struct btrfsic_block_link, | ||
| 1764 | node_ref_from); | ||
| 1765 | |||
| 1766 | printk(KERN_INFO " %c @%llu (%s/%llu/%d)" | 1740 | printk(KERN_INFO " %c @%llu (%s/%llu/%d)" |
| 1767 | " is ref %u* from" | 1741 | " is ref %u* from" |
| 1768 | " %c @%llu (%s/%llu/%d)\n", | 1742 | " %c @%llu (%s/%llu/%d)\n", |
| @@ -1845,8 +1819,7 @@ again: | |||
| 1845 | &state->block_hashtable); | 1819 | &state->block_hashtable); |
| 1846 | if (NULL != block) { | ||
