mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
Btrfs: Fix delayed allocation to avoid missing delalloc extents
find_lock_delalloc_range could exit out too early Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
4aec2b5232
commit
190662b212
2 changed files with 8 additions and 2 deletions
|
@ -1070,6 +1070,7 @@ u64 find_lock_delalloc_range(struct extent_map_tree *tree,
|
||||||
search_again:
|
search_again:
|
||||||
node = tree_search(&tree->state, cur_start);
|
node = tree_search(&tree->state, cur_start);
|
||||||
if (!node || IS_ERR(node)) {
|
if (!node || IS_ERR(node)) {
|
||||||
|
*end = (u64)-1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,6 +1080,8 @@ u64 find_lock_delalloc_range(struct extent_map_tree *tree,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!(state->state & EXTENT_DELALLOC)) {
|
if (!(state->state & EXTENT_DELALLOC)) {
|
||||||
|
if (!found)
|
||||||
|
*end = state->end;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
@ -1841,8 +1844,10 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
|
||||||
nr_delalloc = find_lock_delalloc_range(tree, &delalloc_start,
|
nr_delalloc = find_lock_delalloc_range(tree, &delalloc_start,
|
||||||
&delalloc_end,
|
&delalloc_end,
|
||||||
128 * 1024 * 1024);
|
128 * 1024 * 1024);
|
||||||
if (nr_delalloc <= 0)
|
if (nr_delalloc == 0) {
|
||||||
break;
|
delalloc_start = delalloc_end + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
tree->ops->fill_delalloc(inode, delalloc_start,
|
tree->ops->fill_delalloc(inode, delalloc_start,
|
||||||
delalloc_end);
|
delalloc_end);
|
||||||
clear_extent_bit(tree, delalloc_start,
|
clear_extent_bit(tree, delalloc_start,
|
||||||
|
|
|
@ -798,6 +798,7 @@ static int btrfs_cow_one_page(struct inode *inode, struct page *page,
|
||||||
u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT;
|
u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT;
|
||||||
u64 page_end = page_start + PAGE_CACHE_SIZE - 1;
|
u64 page_end = page_start + PAGE_CACHE_SIZE - 1;
|
||||||
|
|
||||||
|
WARN_ON(!PageLocked(page));
|
||||||
set_page_extent_mapped(page);
|
set_page_extent_mapped(page);
|
||||||
|
|
||||||
lock_extent(em_tree, page_start, page_end, GFP_NOFS);
|
lock_extent(em_tree, page_start, page_end, GFP_NOFS);
|
||||||
|
|
Loading…
Reference in a new issue