aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-10-12 15:54:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-10-12 15:54:24 -0400
commitd64dab903fb3abb42ef2a3fc2d8aa064105e5dca (patch)
tree83853935d893afec5e393c072b3cf30348da8838 /fs
parentd192f0d57c882ebd83e3658d9a1eb52894f19c1c (diff)
parentc00869f1ae6a8fa49802d5e60d843b7051a112ec (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason: "We've got more bug fixes in my for-linus branch: One of these fixes another corner of the compression oops from last time. Miao nailed down some problems with concurrent snapshot deletion and drive balancing. I kept out one of his patches for more testing, but these are all stable" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: fix oops caused by the space balance and dead roots Btrfs: insert orphan roots into fs radix tree Btrfs: limit delalloc pages outside of find_delalloc_range Btrfs: use right root when checking for hash collision
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c9
-rw-r--r--fs/btrfs/disk-io.h13
-rw-r--r--fs/btrfs/extent_io.c12
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--fs/btrfs/relocation.c2
-rw-r--r--fs/btrfs/root-tree.c8
6 files changed, 25 insertions, 21 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4ae17ed13b32..62176ad89846 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1561,8 +1561,9 @@ int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
1561 return ret; 1561 return ret;
1562} 1562}
1563 1563
1564struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, 1564struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
1565 struct btrfs_key *location) 1565 struct btrfs_key *location,
1566 bool check_ref)
1566{ 1567{
1567 struct btrfs_root *root; 1568 struct btrfs_root *root;
1568 int ret; 1569 int ret;
@@ -1586,7 +1587,7 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
1586again: 1587again:
1587 root = btrfs_lookup_fs_root(fs_info, location->objectid); 1588 root = btrfs_lookup_fs_root(fs_info, location->objectid);
1588 if (root) { 1589 if (root) {
1589 if (btrfs_root_refs(&root->root_item) == 0) 1590 if (check_ref && btrfs_root_refs(&root->root_item) == 0)
1590 return ERR_PTR(-ENOENT); 1591 return ERR_PTR(-ENOENT);
1591 return root; 1592 return root;
1592 } 1593 }
@@ -1595,7 +1596,7 @@ again:
1595 if (IS_ERR(root)) 1596 if (IS_ERR(root))
1596 return root; 1597 return root;
1597 1598
1598 if (btrfs_root_refs(&root->root_item) == 0) { 1599 if (check_ref && btrfs_root_refs(&root->root_item) == 0) {
1599 ret = -ENOENT; 1600 ret = -ENOENT;
1600 goto fail; 1601 goto fail;
1601 } 1602 }
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index b71acd6e1e5b..5ce2a7da8b11 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -68,8 +68,17 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root,
68int btrfs_init_fs_root(struct btrfs_root *root); 68int btrfs_init_fs_root(struct btrfs_root *root);
69int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, 69int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
70 struct btrfs_root *root); 70 struct btrfs_root *root);
71struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, 71
72 struct btrfs_key *location); 72struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
73 struct btrfs_key *key,
74 bool check_ref);
75static inline struct btrfs_root *
76btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
77 struct btrfs_key *location)
78{
79 return btrfs_get_fs_root(fs_info, location, true);
80}
81
73int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info); 82int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
74void btrfs_btree_balance_dirty(struct btrfs_root *root); 83void btrfs_btree_balance_dirty(struct btrfs_root *root);
75void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root); 84void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 22bda32acb89..51731b76900d 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1490,10 +1490,8 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
1490 cur_start = state->end + 1; 1490 cur_start = state->end + 1;
1491 node = rb_next(node); 1491 node = rb_next(node);
1492 total_bytes += state->end - state->start + 1; 1492 total_bytes += state->end - state->start + 1;
1493 if (total_bytes >= max_bytes) { 1493 if (total_bytes >= max_bytes)
1494 *end = *start + max_bytes - 1;
1495 break; 1494 break;
1496 }
1497 if (!node) 1495 if (!node)
1498 break; 1496 break;
1499 } 1497 }
@@ -1635,10 +1633,9 @@ again:
1635 1633
1636 /* 1634 /*
1637 * make sure to limit the number of pages we try to lock down 1635 * make sure to limit the number of pages we try to lock down
1638 * if we're looping.
1639 */ 1636 */
1640 if (delalloc_end + 1 - delalloc_start > max_bytes && loops) 1637 if (delalloc_end + 1 - delalloc_start > max_bytes)
1641 delalloc_end = delalloc_start + PAGE_CACHE_SIZE - 1; 1638 delalloc_end = delalloc_start + max_bytes - 1;
1642 1639
1643 /* step two, lock all the pages after the page that has start */ 1640 /* step two, lock all the pages after the page that has start */
1644 ret = lock_delalloc_pages(inode, locked_page, 1641 ret = lock_delalloc_pages(inode, locked_page,
@@ -1649,8 +1646,7 @@ again:
1649 */ 1646 */
1650 free_extent_state(cached_state); 1647 free_extent_state(cached_state);
1651 if (!loops) { 1648 if (!loops) {
1652 unsigned long offset = (*start) & (PAGE_CACHE_SIZE - 1); 1649 max_bytes = PAGE_CACHE_SIZE;
1653 max_bytes = PAGE_CACHE_SIZE - offset;
1654 loops = 1; 1650 loops = 1;
1655 goto again; 1651 goto again;
1656 } else { 1652 } else {
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 22ebc13b6c99..b0ef7b07b1b3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7986,7 +7986,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7986 7986
7987 7987
7988 /* check for collisions, even if the name isn't there */ 7988 /* check for collisions, even if the name isn't there */
7989 ret = btrfs_check_dir_item_collision(root, new_dir->i_ino, 7989 ret = btrfs_check_dir_item_collision(dest, new_dir->i_ino,
7990 new_dentry->d_name.name, 7990 new_dentry->d_name.name,
7991 new_dentry->d_name.len); 7991 new_dentry->d_name.len);
7992 7992
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index a5a26320503f..4a355726151e 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -588,7 +588,7 @@ static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info,
588 else 588 else
589 key.offset = (u64)-1; 589 key.offset = (u64)-1;
590 590
591 return btrfs_read_fs_root_no_name(fs_info, &key); 591 return btrfs_get_fs_root(fs_info, &key, false);
592} 592}
593 593
594#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 594#ifdef BTRFS_COMPAT_EXTENT_TREE_V0
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 0b1f4ef8db98..ec71ea44d2b4 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -299,11 +299,6 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
299 continue; 299 continue;
300 } 300 }
301 301
302 if (btrfs_root_refs(&root->root_item) == 0) {
303 btrfs_add_dead_root(root);
304 continue;
305 }
306
307 err = btrfs_init_fs_root(root); 302 err = btrfs_init_fs_root(root);
308 if (err) { 303 if (err) {
309 btrfs_free_fs_root(root); 304 btrfs_free_fs_root(root);
@@ -318,6 +313,9 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
318 btrfs_free_fs_root(root); 313 btrfs_free_fs_root(root);
319 break; 314 break;
320 } 315 }
316
317 if (btrfs_root_refs(&root->root_item) == 0)
318 btrfs_add_dead_root(root);
321 } 319 }
322 320
323 btrfs_free_path(path); 321 btrfs_free_path(path);