diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-05 10:23:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-05 10:23:03 -0500 |
commit | adbfbcd12af3d183957622a99ca009b665639b81 (patch) | |
tree | 830e5cc6a0dbd5cb590b8484c4234bd65073d1d7 /fs | |
parent | fc76be434d90bcd57a0ea6b93a2e66a3fec4b664 (diff) | |
parent | 23b5c50945f2294add0137799400329c0ebba290 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: apply updated fallocate i_size fix
Btrfs: do not try and lookup the file extent when finishing ordered io
Btrfs: Fix oopsen when dropping empty tree.
Btrfs: remove BUG_ON() due to mounting bad filesystem
Btrfs: make error return negative in btrfs_sync_file()
Btrfs: fix race between allocate and release extent buffer.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 7 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 3 | ||||
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 50 | ||||
-rw-r--r-- | fs/btrfs/relocation.c | 3 |
6 files changed, 19 insertions, 54 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 87b25543d7d1..2b59201b955c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1982,7 +1982,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1982 | 1982 | ||
1983 | if (!(sb->s_flags & MS_RDONLY)) { | 1983 | if (!(sb->s_flags & MS_RDONLY)) { |
1984 | ret = btrfs_recover_relocation(tree_root); | 1984 | ret = btrfs_recover_relocation(tree_root); |
1985 | BUG_ON(ret); | 1985 | if (ret < 0) { |
1986 | printk(KERN_WARNING | ||
1987 | "btrfs: failed to recover relocation\n"); | ||
1988 | err = -EINVAL; | ||
1989 | goto fail_trans_kthread; | ||
1990 | } | ||
1986 | } | 1991 | } |
1987 | 1992 | ||
1988 | location.objectid = BTRFS_FS_TREE_OBJECTID; | 1993 | location.objectid = BTRFS_FS_TREE_OBJECTID; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 432a2da4641e..559f72489b3b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5402,10 +5402,6 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
5402 | int ret; | 5402 | int ret; |
5403 | 5403 | ||
5404 | while (level >= 0) { | 5404 | while (level >= 0) { |
5405 | if (path->slots[level] >= | ||
5406 | btrfs_header_nritems(path->nodes[level])) | ||
5407 | break; | ||
5408 | |||
5409 | ret = walk_down_proc(trans, root, path, wc, lookup_info); | 5405 | ret = walk_down_proc(trans, root, path, wc, lookup_info); |
5410 | if (ret > 0) | 5406 | if (ret > 0) |
5411 | break; | 5407 | break; |
@@ -5413,6 +5409,10 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
5413 | if (level == 0) | 5409 | if (level == 0) |
5414 | break; | 5410 | break; |
5415 | 5411 | ||
5412 | if (path->slots[level] >= | ||
5413 | btrfs_header_nritems(path->nodes[level])) | ||
5414 | break; | ||
5415 | |||
5416 | ret = do_walk_down(trans, root, path, wc, &lookup_info); | 5416 | ret = do_walk_down(trans, root, path, wc, &lookup_info); |
5417 | if (ret > 0) { | 5417 | if (ret > 0) { |
5418 | path->slots[level]++; | 5418 | path->slots[level]++; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 96577e8bf9fd..b177ed319612 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
3165 | spin_unlock(&tree->buffer_lock); | 3165 | spin_unlock(&tree->buffer_lock); |
3166 | goto free_eb; | 3166 | goto free_eb; |
3167 | } | 3167 | } |
3168 | spin_unlock(&tree->buffer_lock); | ||
3169 | |||
3170 | /* add one reference for the tree */ | 3168 | /* add one reference for the tree */ |
3171 | atomic_inc(&eb->refs); | 3169 | atomic_inc(&eb->refs); |
3170 | spin_unlock(&tree->buffer_lock); | ||
3172 | return eb; | 3171 | return eb; |
3173 | 3172 | ||
3174 | free_eb: | 3173 | free_eb: |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index c02033596f02..9d0809629967 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1133,7 +1133,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1133 | } | 1133 | } |
1134 | mutex_lock(&dentry->d_inode->i_mutex); | 1134 | mutex_lock(&dentry->d_inode->i_mutex); |
1135 | out: | 1135 | out: |
1136 | return ret > 0 ? EIO : ret; | 1136 | return ret > 0 ? -EIO : ret; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | static const struct vm_operations_struct btrfs_file_vm_ops = { | 1139 | static const struct vm_operations_struct btrfs_file_vm_ops = { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8cd109972fa6..4deb280f8969 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1681,24 +1681,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans, | |||
1681 | * before we start the transaction. It limits the amount of btree | 1681 | * before we start the transaction. It limits the amount of btree |
1682 | * reads required while inside the transaction. | 1682 | * reads required while inside the transaction. |
1683 | */ | 1683 | */ |
1684 | static noinline void reada_csum(struct btrfs_root *root, | ||
1685 | struct btrfs_path *path, | ||
1686 | struct btrfs_ordered_extent *ordered_extent) | ||
1687 | { | ||
1688 | struct btrfs_ordered_sum *sum; | ||
1689 | u64 bytenr; | ||
1690 | |||
1691 | sum = list_entry(ordered_extent->list.next, struct btrfs_ordered_sum, | ||
1692 | list); | ||
1693 | bytenr = sum->sums[0].bytenr; | ||
1694 | |||
1695 | /* | ||
1696 | * we don't care about the results, the point of this search is | ||
1697 | * just to get the btree leaves into ram | ||
1698 | */ | ||
1699 | btrfs_lookup_csum(NULL, root->fs_info->csum_root, path, bytenr, 0); | ||
1700 | } | ||
1701 | |||
1702 | /* as ordered data IO finishes, this gets called so we can finish | 1684 | /* as ordered data IO finishes, this gets called so we can finish |
1703 | * an ordered extent if the range of bytes in the file it covers are | 1685 | * an ordered extent if the range of bytes in the file it covers are |
1704 | * fully written. | 1686 | * fully written. |
@@ -1709,7 +1691,6 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1709 | struct btrfs_trans_handle *trans; | 1691 | struct btrfs_trans_handle *trans; |
1710 | struct btrfs_ordered_extent *ordered_extent = NULL; | 1692 | struct btrfs_ordered_extent *ordered_extent = NULL; |
1711 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; | 1693 | struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; |
1712 | struct btrfs_path *path; | ||
1713 | int compressed = 0; | 1694 | int compressed = 0; |
1714 | int ret; | 1695 | int ret; |
1715 | 1696 | ||
@@ -1717,32 +1698,9 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1717 | if (!ret) | 1698 | if (!ret) |
1718 | return 0; | 1699 | return 0; |
1719 | 1700 | ||
1720 | /* | 1701 | ordered_extent = btrfs_lookup_ordered_extent(inode, start); |
1721 | * before we join the transaction, try to do some of our IO. | ||
1722 | * This will limit the amount of IO that we have to do with | ||
1723 | * the transaction running. We're unlikely to need to do any | ||
1724 | * IO if the file extents are new, the disk_i_size checks | ||
1725 | * covers the most common case. | ||
1726 | */ | ||
1727 | if (start < BTRFS_I(inode)->disk_i_size) { | ||
1728 | path = btrfs_alloc_path(); | ||
1729 | if (path) { | ||
1730 | ret = btrfs_lookup_file_extent(NULL, root, path, | ||
1731 | inode->i_ino, | ||
1732 | start, 0); | ||
1733 | ordered_extent = btrfs_lookup_ordered_extent(inode, | ||
1734 | start); | ||
1735 | if (!list_empty(&ordered_extent->list)) { | ||
1736 | btrfs_release_path(root, path); | ||
1737 | reada_csum(root, path, ordered_extent); | ||
1738 | } | ||
1739 | btrfs_free_path(path); | ||
1740 | } | ||
1741 | } | ||
1742 | |||
1743 | if (!ordered_extent) | ||
1744 | ordered_extent = btrfs_lookup_ordered_extent(inode, start); | ||
1745 | BUG_ON(!ordered_extent); | 1702 | BUG_ON(!ordered_extent); |
1703 | |||
1746 | if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) { | 1704 | if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) { |
1747 | BUG_ON(!list_empty(&ordered_extent->list)); | 1705 | BUG_ON(!list_empty(&ordered_extent->list)); |
1748 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); | 1706 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); |
@@ -5841,7 +5799,9 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5841 | inode->i_ctime = CURRENT_TIME; | 5799 | inode->i_ctime = CURRENT_TIME; |
5842 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; | 5800 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; |
5843 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | 5801 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
5844 | cur_offset > inode->i_size) { | 5802 | (actual_len > inode->i_size) && |
5803 | (cur_offset > inode->i_size)) { | ||
5804 | |||
5845 | if (cur_offset > actual_len) | 5805 | if (cur_offset > actual_len) |
5846 | i_size = actual_len; | 5806 | i_size = actual_len; |
5847 | else | 5807 | else |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index ed3e4a2ec2c8..ab7ab5318745 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3764,7 +3764,8 @@ out: | |||
3764 | BTRFS_DATA_RELOC_TREE_OBJECTID); | 3764 | BTRFS_DATA_RELOC_TREE_OBJECTID); |
3765 | if (IS_ERR(fs_root)) | 3765 | if (IS_ERR(fs_root)) |
3766 | err = PTR_ERR(fs_root); | 3766 | err = PTR_ERR(fs_root); |
3767 | btrfs_orphan_cleanup(fs_root); | 3767 | else |
3768 | btrfs_orphan_cleanup(fs_root); | ||
3768 | } | 3769 | } |
3769 | return err; | 3770 | return err; |
3770 | } | 3771 | } |