diff options
| -rw-r--r-- | fs/btrfs/compression.c | 22 | ||||
| -rw-r--r-- | fs/btrfs/ctree.c | 4 | ||||
| -rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
| -rw-r--r-- | fs/btrfs/disk-io.c | 12 | ||||
| -rw-r--r-- | fs/btrfs/extent-tree.c | 23 | ||||
| -rw-r--r-- | fs/btrfs/extent_io.c | 15 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 59 | ||||
| -rw-r--r-- | fs/btrfs/ioctl.c | 7 | ||||
| -rw-r--r-- | fs/btrfs/ordered-data.c | 6 | ||||
| -rw-r--r-- | fs/btrfs/super.c | 23 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 112 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 10 |
12 files changed, 90 insertions, 204 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 629880ec8ac4..396039b3a8a2 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/swap.h> | 31 | #include <linux/swap.h> |
| 32 | #include <linux/writeback.h> | 32 | #include <linux/writeback.h> |
| 33 | #include <linux/bit_spinlock.h> | 33 | #include <linux/bit_spinlock.h> |
| 34 | #include <linux/pagevec.h> | ||
| 35 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| 36 | #include "compat.h" | 35 | #include "compat.h" |
| 37 | #include "ctree.h" | 36 | #include "ctree.h" |
| @@ -446,7 +445,6 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
| 446 | unsigned long nr_pages = 0; | 445 | unsigned long nr_pages = 0; |
| 447 | struct extent_map *em; | 446 | struct extent_map *em; |
| 448 | struct address_space *mapping = inode->i_mapping; | 447 | struct address_space *mapping = inode->i_mapping; |
| 449 | struct pagevec pvec; | ||
| 450 | struct extent_map_tree *em_tree; | 448 | struct extent_map_tree *em_tree; |
| 451 | struct extent_io_tree *tree; | 449 | struct extent_io_tree *tree; |
| 452 | u64 end; | 450 | u64 end; |
| @@ -462,7 +460,6 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
| 462 | 460 | ||
| 463 | end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; | 461 | end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; |
| 464 | 462 | ||
| 465 | pagevec_init(&pvec, 0); | ||
| 466 | while (last_offset < compressed_end) { | 463 | while (last_offset < compressed_end) { |
| 467 | page_index = last_offset >> PAGE_CACHE_SHIFT; | 464 | page_index = last_offset >> PAGE_CACHE_SHIFT; |
| 468 | 465 | ||
| @@ -479,26 +476,17 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
| 479 | goto next; | 476 | goto next; |
| 480 | } | 477 | } |
| 481 | 478 | ||
| 482 | page = alloc_page(mapping_gfp_mask(mapping) & ~__GFP_FS); | 479 | page = __page_cache_alloc(mapping_gfp_mask(mapping) & |
| 480 | ~__GFP_FS); | ||
| 483 | if (!page) | 481 | if (!page) |
| 484 | break; | 482 | break; |
| 485 | 483 | ||
| 486 | page->index = page_index; | 484 | if (add_to_page_cache_lru(page, mapping, page_index, |
| 487 | /* | 485 | GFP_NOFS)) { |
| 488 | * what we want to do here is call add_to_page_cache_lru, | ||
| 489 | * but that isn't exported, so we reproduce it here | ||
| 490 | */ | ||
| 491 | if (add_to_page_cache(page, mapping, | ||
| 492 | page->index, GFP_NOFS)) { | ||
| 493 | page_cache_release(page); | 486 | page_cache_release(page); |
| 494 | goto next; | 487 | goto next; |
| 495 | } | 488 | } |
| 496 | 489 | ||
| 497 | /* open coding of lru_cache_add, also not exported */ | ||
| 498 | page_cache_get(page); | ||
| 499 | if (!pagevec_add(&pvec, page)) | ||
| 500 | __pagevec_lru_add_file(&pvec); | ||
| 501 | |||
| 502 | end = last_offset + PAGE_CACHE_SIZE - 1; | 490 | end = last_offset + PAGE_CACHE_SIZE - 1; |
| 503 | /* | 491 | /* |
| 504 | * at this point, we have a locked page in the page cache | 492 | * at this point, we have a locked page in the page cache |
| @@ -552,8 +540,6 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
| 552 | next: | 540 | next: |
| 553 | last_offset += PAGE_CACHE_SIZE; | 541 | last_offset += PAGE_CACHE_SIZE; |
| 554 | } | 542 | } |
| 555 | if (pagevec_count(&pvec)) | ||
| 556 | __pagevec_lru_add_file(&pvec); | ||
| 557 | return 0; | 543 | return 0; |
| 558 | } | 544 | } |
| 559 | 545 | ||
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 8e29260cd0bb..6795a713b205 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -3041,6 +3041,10 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, | |||
| 3041 | if (ret > 0 || item_size != btrfs_item_size_nr(leaf, path->slots[0])) | 3041 | if (ret > 0 || item_size != btrfs_item_size_nr(leaf, path->slots[0])) |
| 3042 | goto err; | 3042 | goto err; |
| 3043 | 3043 | ||
| 3044 | /* the leaf has changed, it now has room. return now */ | ||
| 3045 | if (btrfs_leaf_free_space(root, path->nodes[0]) >= ins_len) | ||
| 3046 | goto err; | ||
| 3047 | |||
| 3044 | if (key.type == BTRFS_EXTENT_DATA_KEY) { | 3048 | if (key.type == BTRFS_EXTENT_DATA_KEY) { |
| 3045 | fi = btrfs_item_ptr(leaf, path->slots[0], | 3049 | fi = btrfs_item_ptr(leaf, path->slots[0], |
| 3046 | struct btrfs_file_extent_item); | 3050 | struct btrfs_file_extent_item); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8a6518a3f041..746a7248678e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -835,7 +835,6 @@ struct btrfs_fs_info { | |||
| 835 | u64 last_trans_log_full_commit; | 835 | u64 last_trans_log_full_commit; |
| 836 | u64 open_ioctl_trans; | 836 | u64 open_ioctl_trans; |
| 837 | unsigned long mount_opt; | 837 | unsigned long mount_opt; |
| 838 | u64 max_extent; | ||
| 839 | u64 max_inline; | 838 | u64 max_inline; |
| 840 | u64 alloc_start; | 839 | u64 alloc_start; |
| 841 | struct btrfs_transaction *running_transaction; | 840 | struct btrfs_transaction *running_transaction; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e57ded75d910..e7b8f2c89ccb 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -1635,7 +1635,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1635 | atomic_set(&fs_info->async_submit_draining, 0); | 1635 | atomic_set(&fs_info->async_submit_draining, 0); |
| 1636 | atomic_set(&fs_info->nr_async_bios, 0); | 1636 | atomic_set(&fs_info->nr_async_bios, 0); |
| 1637 | fs_info->sb = sb; | 1637 | fs_info->sb = sb; |
| 1638 | fs_info->max_extent = (u64)-1; | ||
| 1639 | fs_info->max_inline = 8192 * 1024; | 1638 | fs_info->max_inline = 8192 * 1024; |
| 1640 | fs_info->metadata_ratio = 0; | 1639 | fs_info->metadata_ratio = 0; |
| 1641 | 1640 | ||
| @@ -1923,7 +1922,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1923 | 1922 | ||
| 1924 | csum_root->track_dirty = 1; | 1923 | csum_root->track_dirty = 1; |
| 1925 | 1924 | ||
| 1926 | btrfs_read_block_groups(extent_root); | 1925 | ret = btrfs_read_block_groups(extent_root); |
| 1926 | if (ret) { | ||
| 1927 | printk(KERN_ERR "Failed to read block groups: %d\n", ret); | ||
| 1928 | goto fail_block_groups; | ||
| 1929 | } | ||
| 1927 | 1930 | ||
| 1928 | fs_info->generation = generation; | 1931 | fs_info->generation = generation; |
| 1929 | fs_info->last_trans_committed = generation; | 1932 | fs_info->last_trans_committed = generation; |
| @@ -1933,7 +1936,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 1933 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 1936 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
| 1934 | "btrfs-cleaner"); | 1937 | "btrfs-cleaner"); |
| 1935 | if (IS_ERR(fs_info->cleaner_kthread)) | 1938 | if (IS_ERR(fs_info->cleaner_kthread)) |
| 1936 | goto fail_csum_root; | 1939 | goto fail_block_groups; |
| 1937 | 1940 | ||
| 1938 | fs_info->transaction_kthread = kthread_run(transaction_kthread, | 1941 | fs_info->transaction_kthread = kthread_run(transaction_kthread, |
| 1939 | tree_root, | 1942 | tree_root, |
| @@ -2021,7 +2024,8 @@ fail_cleaner: | |||
| 2021 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); | 2024 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); |
| 2022 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 2025 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
| 2023 | 2026 | ||
| 2024 | fail_csum_root: | 2027 | fail_block_groups: |
| 2028 | btrfs_free_block_groups(fs_info); | ||
| 2025 | free_extent_buffer(csum_root->node); | 2029 | free_extent_buffer(csum_root->node); |
| 2026 | free_extent_buffer(csum_root->commit_root); | 2030 | free_extent_buffer(csum_root->commit_root); |
| 2027 | fail_dev_root: | 2031 | fail_dev_root: |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index fa2907d531a2..9e23ffea7f54 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -2677,6 +2677,8 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
| 2677 | 2677 | ||
| 2678 | INIT_LIST_HEAD(&found->block_groups); | 2678 | INIT_LIST_HEAD(&found->block_groups); |
| 2679 | init_rwsem(&found->groups_sem); | 2679 | init_rwsem(&found->groups_sem); |
| 2680 | init_waitqueue_head(&found->flush_wait); | ||
| 2681 | init_waitqueue_head(&found->allocate_wait); | ||
| 2680 | spin_lock_init(&found->lock); | 2682 | spin_lock_init(&found->lock); |
| 2681 | found->flags = flags; | 2683 | found->flags = flags; |
| 2682 | found->total_bytes = total_bytes; | 2684 | found->total_bytes = total_bytes; |
| @@ -2847,7 +2849,7 @@ int btrfs_unreserve_metadata_for_delalloc(struct btrfs_root *root, | |||
| 2847 | } | 2849 | } |
| 2848 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 2850 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
| 2849 | 2851 | ||
| 2850 | BTRFS_I(inode)->reserved_extents--; | 2852 | BTRFS_I(inode)->reserved_extents -= num_items; |
| 2851 | BUG_ON(BTRFS_I(inode)->reserved_extents < 0); | 2853 | BUG_ON(BTRFS_I(inode)->reserved_extents < 0); |
| 2852 | 2854 | ||
