On 10/26/2018 07:43 PM, Nikolay Borisov wrote:
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.

Signed-off-by: Nikolay Borisov <nbori...@suse.com>

  Reviewed-by: Anand Jain <anand.j...@oracle.com>

Thanks, Anand

---
  fs/btrfs/extent_io.c             | 11 +++++------
  fs/btrfs/extent_io.h             |  2 +-
  fs/btrfs/tests/extent-io-tests.c | 10 +++++-----
  3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 6877a74c7469..1a9a521aefe5 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1566,8 +1566,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,
-                                   u64 *end, u64 max_bytes)
+                                   u64 *end)
  {
+       u64 max_bytes = BTRFS_MAX_EXTENT_SIZE;
        u64 delalloc_start;
        u64 delalloc_end;
        u64 found;
@@ -1647,10 +1648,9 @@ static noinline_for_stack u64 
find_lock_delalloc_range(struct inode *inode,
  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
@@ -3233,8 +3233,7 @@ static noinline_for_stack int writepage_delalloc(struct inode *inode,
                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;
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 369daa5d4f73..7ec4f93caf78 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -549,7 +549,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 *end, u64 max_bytes);
+                                     u64 *end);
  #endif
  struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
                                               u64 start);
diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c
index 9e0f4a01be14..8ea8c2aa6696 100644
--- a/fs/btrfs/tests/extent-io-tests.c
+++ b/fs/btrfs/tests/extent-io-tests.c
@@ -107,7 +107,7 @@ static int test_find_delalloc(u32 sectorsize)
        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;
@@ -138,7 +138,7 @@ static int test_find_delalloc(u32 sectorsize)
        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;
@@ -172,7 +172,7 @@ static int test_find_delalloc(u32 sectorsize)
        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;
@@ -193,7 +193,7 @@ static int test_find_delalloc(u32 sectorsize)
        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;
@@ -234,7 +234,7 @@ static int test_find_delalloc(u32 sectorsize)
         * 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;

Reply via email to