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/btrfs/inode.c | |
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/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 50 |
1 files changed, 5 insertions, 45 deletions
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 |