aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c12
1 files changed, 4 insertions, 8 deletions
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 {