btrfs: Sink find_lock_delalloc_range's 'max_bytes' argument
authorNikolay Borisov <nborisov@suse.com>
Fri, 26 Oct 2018 11:43:20 +0000 (14:43 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:36 +0000 (14:51 +0100)
All callers of this function pass BTRFS_MAX_EXTENT_SIZE (128M) so let's
reduce the argument count and make that a local variable. No functional
changes.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/tests/extent-io-tests.c

index 926bf30c2f2e80bc806b29775e02844feca7b3b1..d5ac46fa77602da59e97ae0f05b7fe9111d849b5 100644 (file)
@@ -1559,8 +1559,9 @@ static noinline int lock_delalloc_pages(struct inode *inode,
 static noinline_for_stack u64 find_lock_delalloc_range(struct inode *inode,
                                    struct extent_io_tree *tree,
                                    struct page *locked_page, u64 *start,
 static noinline_for_stack u64 find_lock_delalloc_range(struct inode *inode,
                                    struct extent_io_tree *tree,
                                    struct page *locked_page, u64 *start,
-                                   u64 *end, u64 max_bytes)
+                                   u64 *end)
 {
 {
+       u64 max_bytes = BTRFS_MAX_EXTENT_SIZE;
        u64 delalloc_start;
        u64 delalloc_end;
        u64 found;
        u64 delalloc_start;
        u64 delalloc_end;
        u64 found;
@@ -1640,10 +1641,9 @@ out_failed:
 u64 btrfs_find_lock_delalloc_range(struct inode *inode,
                                    struct extent_io_tree *tree,
                                    struct page *locked_page, u64 *start,
 u64 btrfs_find_lock_delalloc_range(struct inode *inode,
                                    struct extent_io_tree *tree,
                                    struct page *locked_page, u64 *start,
-                                   u64 *end, u64 max_bytes)
+                                   u64 *end)
 {
 {
-       return find_lock_delalloc_range(inode, tree, locked_page, start, end,
-                       max_bytes);
+       return find_lock_delalloc_range(inode, tree, locked_page, start, end);
 }
 #endif
 
 }
 #endif
 
@@ -3217,8 +3217,7 @@ static noinline_for_stack int writepage_delalloc(struct inode *inode,
                nr_delalloc = find_lock_delalloc_range(inode, tree,
                                               page,
                                               &delalloc_start,
                nr_delalloc = find_lock_delalloc_range(inode, tree,
                                               page,
                                               &delalloc_start,
-                                              &delalloc_end,
-                                              BTRFS_MAX_EXTENT_SIZE);
+                                              &delalloc_end);
                if (nr_delalloc == 0) {
                        delalloc_start = delalloc_end + 1;
                        continue;
                if (nr_delalloc == 0) {
                        delalloc_start = delalloc_end + 1;
                        continue;
index d96fd534f1449bc1da0779092b5b952d03ecdcad..30bfeefa2d899f7d6c133e5311832c230cfd7f53 100644 (file)
@@ -525,7 +525,7 @@ int free_io_failure(struct extent_io_tree *failure_tree,
 u64 btrfs_find_lock_delalloc_range(struct inode *inode,
                                      struct extent_io_tree *tree,
                                      struct page *locked_page, u64 *start,
 u64 btrfs_find_lock_delalloc_range(struct inode *inode,
                                      struct extent_io_tree *tree,
                                      struct page *locked_page, u64 *start,
-                                     u64 *end, u64 max_bytes);
+                                     u64 *end);
 #endif
 struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
                                               u64 start);
 #endif
 struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
                                               u64 start);
index a99dc04331b4fabb2e2fecc07c40c276ca07a255..db073fdbdd65e0ab6e83eceb55859066f1e3d24a 100644 (file)
@@ -108,7 +108,7 @@ static int test_find_delalloc(u32 sectorsize)
        start = 0;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
        start = 0;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
-                                        &end, max_bytes);
+                                        &end);
        if (!found) {
                test_err("should have found at least one delalloc");
                goto out_bits;
        if (!found) {
                test_err("should have found at least one delalloc");
                goto out_bits;
@@ -139,7 +139,7 @@ static int test_find_delalloc(u32 sectorsize)
        start = test_start;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
        start = test_start;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
-                                        &end, max_bytes);
+                                        &end);
        if (!found) {
                test_err("couldn't find delalloc in our range");
                goto out_bits;
        if (!found) {
                test_err("couldn't find delalloc in our range");
                goto out_bits;
@@ -173,7 +173,7 @@ static int test_find_delalloc(u32 sectorsize)
        start = test_start;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
        start = test_start;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
-                                        &end, max_bytes);
+                                        &end);
        if (found) {
                test_err("found range when we shouldn't have");
                goto out_bits;
        if (found) {
                test_err("found range when we shouldn't have");
                goto out_bits;
@@ -194,7 +194,7 @@ static int test_find_delalloc(u32 sectorsize)
        start = test_start;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
        start = test_start;
        end = 0;
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
-                                        &end, max_bytes);
+                                        &end);
        if (!found) {
                test_err("didn't find our range");
                goto out_bits;
        if (!found) {
                test_err("didn't find our range");
                goto out_bits;
@@ -235,7 +235,7 @@ static int test_find_delalloc(u32 sectorsize)
         * tests expected behavior.
         */
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
         * tests expected behavior.
         */
        found = btrfs_find_lock_delalloc_range(inode, &tmp, locked_page, &start,
-                                        &end, max_bytes);
+                                        &end);
        if (!found) {
                test_err("didn't find our range");
                goto out_bits;
        if (!found) {
                test_err("didn't find our range");
                goto out_bits;