diff options
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 09582b81640c..51731b76900d 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -145,8 +145,16 @@ int __init extent_io_init(void) | |||
145 | offsetof(struct btrfs_io_bio, bio)); | 145 | offsetof(struct btrfs_io_bio, bio)); |
146 | if (!btrfs_bioset) | 146 | if (!btrfs_bioset) |
147 | goto free_buffer_cache; | 147 | goto free_buffer_cache; |
148 | |||
149 | if (bioset_integrity_create(btrfs_bioset, BIO_POOL_SIZE)) | ||
150 | goto free_bioset; | ||
151 | |||
148 | return 0; | 152 | return 0; |
149 | 153 | ||
154 | free_bioset: | ||
155 | bioset_free(btrfs_bioset); | ||
156 | btrfs_bioset = NULL; | ||
157 | |||
150 | free_buffer_cache: | 158 | free_buffer_cache: |
151 | kmem_cache_destroy(extent_buffer_cache); | 159 | kmem_cache_destroy(extent_buffer_cache); |
152 | extent_buffer_cache = NULL; | 160 | extent_buffer_cache = NULL; |
@@ -1481,11 +1489,11 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree, | |||
1481 | *end = state->end; | 1489 | *end = state->end; |
1482 | cur_start = state->end + 1; | 1490 | cur_start = state->end + 1; |
1483 | node = rb_next(node); | 1491 | node = rb_next(node); |
1484 | if (!node) | ||
1485 | break; | ||
1486 | total_bytes += state->end - state->start + 1; | 1492 | total_bytes += state->end - state->start + 1; |
1487 | if (total_bytes >= max_bytes) | 1493 | if (total_bytes >= max_bytes) |
1488 | break; | 1494 | break; |
1495 | if (!node) | ||
1496 | break; | ||
1489 | } | 1497 | } |
1490 | out: | 1498 | out: |
1491 | spin_unlock(&tree->lock); | 1499 | spin_unlock(&tree->lock); |
@@ -1612,7 +1620,7 @@ again: | |||
1612 | *start = delalloc_start; | 1620 | *start = delalloc_start; |
1613 | *end = delalloc_end; | 1621 | *end = delalloc_end; |
1614 | free_extent_state(cached_state); | 1622 | free_extent_state(cached_state); |
1615 | return found; | 1623 | return 0; |
1616 | } | 1624 | } |
1617 | 1625 | ||
1618 | /* | 1626 | /* |
@@ -1625,10 +1633,9 @@ again: | |||
1625 | 1633 | ||
1626 | /* | 1634 | /* |
1627 | * 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 |
1628 | * if we're looping. | ||
1629 | */ | 1636 | */ |
1630 | if (delalloc_end + 1 - delalloc_start > max_bytes && loops) | 1637 | if (delalloc_end + 1 - delalloc_start > max_bytes) |
1631 | delalloc_end = delalloc_start + PAGE_CACHE_SIZE - 1; | 1638 | delalloc_end = delalloc_start + max_bytes - 1; |
1632 | 1639 | ||
1633 | /* 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 */ |
1634 | ret = lock_delalloc_pages(inode, locked_page, | 1641 | ret = lock_delalloc_pages(inode, locked_page, |
@@ -1639,8 +1646,7 @@ again: | |||
1639 | */ | 1646 | */ |
1640 | free_extent_state(cached_state); | 1647 | free_extent_state(cached_state); |
1641 | if (!loops) { | 1648 | if (!loops) { |
1642 | unsigned long offset = (*start) & (PAGE_CACHE_SIZE - 1); | 1649 | max_bytes = PAGE_CACHE_SIZE; |
1643 | max_bytes = PAGE_CACHE_SIZE - offset; | ||
1644 | loops = 1; | 1650 | loops = 1; |
1645 | goto again; | 1651 | goto again; |
1646 | } else { | 1652 | } else { |