1010#include "btrfs-tests.h"
1111#include "../ctree.h"
1212#include "../extent_io.h"
13+ #include "../btrfs_inode.h"
1314
1415#define PROCESS_UNLOCK (1 << 0)
1516#define PROCESS_RELEASE (1 << 1)
@@ -58,7 +59,7 @@ static noinline int process_page_range(struct inode *inode, u64 start, u64 end,
5859static int test_find_delalloc (u32 sectorsize )
5960{
6061 struct inode * inode ;
61- struct extent_io_tree tmp ;
62+ struct extent_io_tree * tmp ;
6263 struct page * page ;
6364 struct page * locked_page = NULL ;
6465 unsigned long index = 0 ;
@@ -76,12 +77,13 @@ static int test_find_delalloc(u32 sectorsize)
7677 test_std_err (TEST_ALLOC_INODE );
7778 return - ENOMEM ;
7879 }
80+ tmp = & BTRFS_I (inode )-> io_tree ;
7981
8082 /*
8183 * Passing NULL as we don't have fs_info but tracepoints are not used
8284 * at this point
8385 */
84- extent_io_tree_init (NULL , & tmp , IO_TREE_SELFTEST , NULL );
86+ extent_io_tree_init (NULL , tmp , IO_TREE_SELFTEST , NULL );
8587
8688 /*
8789 * First go through and create and mark all of our pages dirty, we pin
@@ -108,10 +110,10 @@ static int test_find_delalloc(u32 sectorsize)
108110 * |--- delalloc ---|
109111 * |--- search ---|
110112 */
111- set_extent_delalloc (& tmp , 0 , sectorsize - 1 , 0 , NULL );
113+ set_extent_delalloc (tmp , 0 , sectorsize - 1 , 0 , NULL );
112114 start = 0 ;
113115 end = 0 ;
114- found = find_lock_delalloc_range (inode , & tmp , locked_page , & start ,
116+ found = find_lock_delalloc_range (inode , locked_page , & start ,
115117 & end );
116118 if (!found ) {
117119 test_err ("should have found at least one delalloc" );
@@ -122,7 +124,7 @@ static int test_find_delalloc(u32 sectorsize)
122124 sectorsize - 1 , start , end );
123125 goto out_bits ;
124126 }
125- unlock_extent (& tmp , start , end );
127+ unlock_extent (tmp , start , end );
126128 unlock_page (locked_page );
127129 put_page (locked_page );
128130
@@ -139,10 +141,10 @@ static int test_find_delalloc(u32 sectorsize)
139141 test_err ("couldn't find the locked page" );
140142 goto out_bits ;
141143 }
142- set_extent_delalloc (& tmp , sectorsize , max_bytes - 1 , 0 , NULL );
144+ set_extent_delalloc (tmp , sectorsize , max_bytes - 1 , 0 , NULL );
143145 start = test_start ;
144146 end = 0 ;
145- found = find_lock_delalloc_range (inode , & tmp , locked_page , & start ,
147+ found = find_lock_delalloc_range (inode , locked_page , & start ,
146148 & end );
147149 if (!found ) {
148150 test_err ("couldn't find delalloc in our range" );
@@ -158,7 +160,7 @@ static int test_find_delalloc(u32 sectorsize)
158160 test_err ("there were unlocked pages in the range" );
159161 goto out_bits ;
160162 }
161- unlock_extent (& tmp , start , end );
163+ unlock_extent (tmp , start , end );
162164 /* locked_page was unlocked above */
163165 put_page (locked_page );
164166
@@ -176,7 +178,7 @@ static int test_find_delalloc(u32 sectorsize)
176178 }
177179 start = test_start ;
178180 end = 0 ;
179- found = find_lock_delalloc_range (inode , & tmp , locked_page , & start ,
181+ found = find_lock_delalloc_range (inode , locked_page , & start ,
180182 & end );
181183 if (found ) {
182184 test_err ("found range when we shouldn't have" );
@@ -194,10 +196,10 @@ static int test_find_delalloc(u32 sectorsize)
194196 *
195197 * We are re-using our test_start from above since it works out well.
196198 */
197- set_extent_delalloc (& tmp , max_bytes , total_dirty - 1 , 0 , NULL );
199+ set_extent_delalloc (tmp , max_bytes , total_dirty - 1 , 0 , NULL );
198200 start = test_start ;
199201 end = 0 ;
200- found = find_lock_delalloc_range (inode , & tmp , locked_page , & start ,
202+ found = find_lock_delalloc_range (inode , locked_page , & start ,
201203 & end );
202204 if (!found ) {
203205 test_err ("didn't find our range" );
@@ -213,7 +215,7 @@ static int test_find_delalloc(u32 sectorsize)
213215 test_err ("pages in range were not all locked" );
214216 goto out_bits ;
215217 }
216- unlock_extent (& tmp , start , end );
218+ unlock_extent (tmp , start , end );
217219
218220 /*
219221 * Now to test where we run into a page that is no longer dirty in the
@@ -238,7 +240,7 @@ static int test_find_delalloc(u32 sectorsize)
238240 * this changes at any point in the future we will need to fix this
239241 * tests expected behavior.
240242 */
241- found = find_lock_delalloc_range (inode , & tmp , locked_page , & start ,
243+ found = find_lock_delalloc_range (inode , locked_page , & start ,
242244 & end );
243245 if (!found ) {
244246 test_err ("didn't find our range" );
@@ -256,7 +258,7 @@ static int test_find_delalloc(u32 sectorsize)
256258 }
257259 ret = 0 ;
258260out_bits :
259- clear_extent_bits (& tmp , 0 , total_dirty - 1 , (unsigned )-1 );
261+ clear_extent_bits (tmp , 0 , total_dirty - 1 , (unsigned )-1 );
260262out :
261263 if (locked_page )
262264 put_page (locked_page );
0 commit comments