diff options
-rw-r--r-- | fs/btrfs/extent_map.c | 9 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 0d1e59a86e49..a0dff34dd437 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -1070,6 +1070,7 @@ u64 find_lock_delalloc_range(struct extent_map_tree *tree, | |||
1070 | search_again: | 1070 | search_again: |
1071 | node = tree_search(&tree->state, cur_start); | 1071 | node = tree_search(&tree->state, cur_start); |
1072 | if (!node || IS_ERR(node)) { | 1072 | if (!node || IS_ERR(node)) { |
1073 | *end = (u64)-1; | ||
1073 | goto out; | 1074 | goto out; |
1074 | } | 1075 | } |
1075 | 1076 | ||
@@ -1079,6 +1080,8 @@ search_again: | |||
1079 | goto out; | 1080 | goto out; |
1080 | } | 1081 | } |
1081 | if (!(state->state & EXTENT_DELALLOC)) { | 1082 | if (!(state->state & EXTENT_DELALLOC)) { |
1083 | if (!found) | ||
1084 | *end = state->end; | ||
1082 | goto out; | 1085 | goto out; |
1083 | } | 1086 | } |
1084 | if (!found) { | 1087 | if (!found) { |
@@ -1841,8 +1844,10 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, | |||
1841 | nr_delalloc = find_lock_delalloc_range(tree, &delalloc_start, | 1844 | nr_delalloc = find_lock_delalloc_range(tree, &delalloc_start, |
1842 | &delalloc_end, | 1845 | &delalloc_end, |
1843 | 128 * 1024 * 1024); | 1846 | 128 * 1024 * 1024); |
1844 | if (nr_delalloc <= 0) | 1847 | if (nr_delalloc == 0) { |
1845 | break; | 1848 | delalloc_start = delalloc_end + 1; |
1849 | continue; | ||
1850 | } | ||
1846 | tree->ops->fill_delalloc(inode, delalloc_start, | 1851 | tree->ops->fill_delalloc(inode, delalloc_start, |
1847 | delalloc_end); | 1852 | delalloc_end); |
1848 | clear_extent_bit(tree, delalloc_start, | 1853 | clear_extent_bit(tree, delalloc_start, |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1e725a48467c..55b2e1426024 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -798,6 +798,7 @@ static int btrfs_cow_one_page(struct inode *inode, struct page *page, | |||
798 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; | 798 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
799 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; | 799 | u64 page_end = page_start + PAGE_CACHE_SIZE - 1; |
800 | 800 | ||
801 | WARN_ON(!PageLocked(page)); | ||
801 | set_page_extent_mapped(page); | 802 | set_page_extent_mapped(page); |
802 | 803 | ||
803 | lock_extent(em_tree, page_start, page_end, GFP_NOFS); | 804 | lock_extent(em_tree, page_start, page_end, GFP_NOFS); |