diff options
Diffstat (limited to 'fs/btrfs/tests/extent-io-tests.c')
-rw-r--r-- | fs/btrfs/tests/extent-io-tests.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/btrfs/tests/extent-io-tests.c b/fs/btrfs/tests/extent-io-tests.c index 669b58201e36..70948b13bc81 100644 --- a/fs/btrfs/tests/extent-io-tests.c +++ b/fs/btrfs/tests/extent-io-tests.c | |||
@@ -32,8 +32,8 @@ static noinline int process_page_range(struct inode *inode, u64 start, u64 end, | |||
32 | { | 32 | { |
33 | int ret; | 33 | int ret; |
34 | struct page *pages[16]; | 34 | struct page *pages[16]; |
35 | unsigned long index = start >> PAGE_CACHE_SHIFT; | 35 | unsigned long index = start >> PAGE_SHIFT; |
36 | unsigned long end_index = end >> PAGE_CACHE_SHIFT; | 36 | unsigned long end_index = end >> PAGE_SHIFT; |
37 | unsigned long nr_pages = end_index - index + 1; | 37 | unsigned long nr_pages = end_index - index + 1; |
38 | int i; | 38 | int i; |
39 | int count = 0; | 39 | int count = 0; |
@@ -49,9 +49,9 @@ static noinline int process_page_range(struct inode *inode, u64 start, u64 end, | |||
49 | count++; | 49 | count++; |
50 | if (flags & PROCESS_UNLOCK && PageLocked(pages[i])) | 50 | if (flags & PROCESS_UNLOCK && PageLocked(pages[i])) |
51 | unlock_page(pages[i]); | 51 | unlock_page(pages[i]); |
52 | page_cache_release(pages[i]); | 52 | put_page(pages[i]); |
53 | if (flags & PROCESS_RELEASE) | 53 | if (flags & PROCESS_RELEASE) |
54 | page_cache_release(pages[i]); | 54 | put_page(pages[i]); |
55 | } | 55 | } |
56 | nr_pages -= ret; | 56 | nr_pages -= ret; |
57 | index += ret; | 57 | index += ret; |
@@ -93,7 +93,7 @@ static int test_find_delalloc(void) | |||
93 | * everything to make sure our pages don't get evicted and screw up our | 93 | * everything to make sure our pages don't get evicted and screw up our |
94 | * test. | 94 | * test. |
95 | */ | 95 | */ |
96 | for (index = 0; index < (total_dirty >> PAGE_CACHE_SHIFT); index++) { | 96 | for (index = 0; index < (total_dirty >> PAGE_SHIFT); index++) { |
97 | page = find_or_create_page(inode->i_mapping, index, GFP_KERNEL); | 97 | page = find_or_create_page(inode->i_mapping, index, GFP_KERNEL); |
98 | if (!page) { | 98 | if (!page) { |
99 | test_msg("Failed to allocate test page\n"); | 99 | test_msg("Failed to allocate test page\n"); |
@@ -104,7 +104,7 @@ static int test_find_delalloc(void) | |||
104 | if (index) { | 104 | if (index) { |
105 | unlock_page(page); | 105 | unlock_page(page); |
106 | } else { | 106 | } else { |
107 | page_cache_get(page); | 107 | get_page(page); |
108 | locked_page = page; | 108 | locked_page = page; |
109 | } | 109 | } |
110 | } | 110 | } |
@@ -129,7 +129,7 @@ static int test_find_delalloc(void) | |||
129 | } | 129 | } |
130 | unlock_extent(&tmp, start, end); | 130 | unlock_extent(&tmp, start, end); |
131 | unlock_page(locked_page); | 131 | unlock_page(locked_page); |
132 | page_cache_release(locked_page); | 132 | put_page(locked_page); |
133 | 133 | ||
134 | /* | 134 | /* |
135 | * Test this scenario | 135 | * Test this scenario |
@@ -139,7 +139,7 @@ static int test_find_delalloc(void) | |||
139 | */ | 139 | */ |
140 | test_start = SZ_64M; | 140 | test_start = SZ_64M; |
141 | locked_page = find_lock_page(inode->i_mapping, | 141 | locked_page = find_lock_page(inode->i_mapping, |
142 | test_start >> PAGE_CACHE_SHIFT); | 142 | test_start >> PAGE_SHIFT); |
143 | if (!locked_page) { | 143 | if (!locked_page) { |
144 | test_msg("Couldn't find the locked page\n"); | 144 | test_msg("Couldn't find the locked page\n"); |
145 | goto out_bits; | 145 | goto out_bits; |
@@ -165,7 +165,7 @@ static int test_find_delalloc(void) | |||
165 | } | 165 | } |
166 | unlock_extent(&tmp, start, end); | 166 | unlock_extent(&tmp, start, end); |
167 | /* locked_page was unlocked above */ | 167 | /* locked_page was unlocked above */ |
168 | page_cache_release(locked_page); | 168 | put_page(locked_page); |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * Test this scenario | 171 | * Test this scenario |
@@ -174,7 +174,7 @@ static int test_find_delalloc(void) | |||
174 | */ | 174 | */ |
175 | test_start = max_bytes + 4096; | 175 | test_start = max_bytes + 4096; |
176 | locked_page = find_lock_page(inode->i_mapping, test_start >> | 176 | locked_page = find_lock_page(inode->i_mapping, test_start >> |
177 | PAGE_CACHE_SHIFT); | 177 | PAGE_SHIFT); |
178 | if (!locked_page) { | 178 | if (!locked_page) { |
179 | test_msg("Could'nt find the locked page\n"); | 179 | test_msg("Could'nt find the locked page\n"); |
180 | goto out_bits; | 180 | goto out_bits; |
@@ -225,13 +225,13 @@ static int test_find_delalloc(void) | |||
225 | * range we want to find. | 225 | * range we want to find. |
226 | */ | 226 | */ |
227 | page = find_get_page(inode->i_mapping, | 227 | page = find_get_page(inode->i_mapping, |
228 | (max_bytes + SZ_1M) >> PAGE_CACHE_SHIFT); | 228 | (max_bytes + SZ_1M) >> PAGE_SHIFT); |
229 | if (!page) { | 229 | if (!page) { |
230 | test_msg("Couldn't find our page\n"); | 230 | test_msg("Couldn't find our page\n"); |
231 | goto out_bits; | 231 | goto out_bits; |
232 | } | 232 | } |
233 | ClearPageDirty(page); | 233 | ClearPageDirty(page); |
234 | page_cache_release(page); | 234 | put_page(page); |
235 | 235 | ||
236 | /* We unlocked it in the previous test */ | 236 | /* We unlocked it in the previous test */ |
237 | lock_page(locked_page); | 237 | lock_page(locked_page); |
@@ -239,7 +239,7 @@ static int test_find_delalloc(void) | |||
239 | end = 0; | 239 | end = 0; |
240 | /* | 240 | /* |
241 | * Currently if we fail to find dirty pages in the delalloc range we | 241 | * Currently if we fail to find dirty pages in the delalloc range we |
242 | * will adjust max_bytes down to PAGE_CACHE_SIZE and then re-search. If | 242 | * will adjust max_bytes down to PAGE_SIZE and then re-search. If |
243 | * this changes at any point in the future we will need to fix this | 243 | * this changes at any point in the future we will need to fix this |
244 | * tests expected behavior. | 244 | * tests expected behavior. |
245 | */ | 245 | */ |
@@ -249,9 +249,9 @@ static int test_find_delalloc(void) | |||
249 | test_msg("Didn't find our range\n"); | 249 | test_msg("Didn't find our range\n"); |
250 | goto out_bits; | 250 | goto out_bits; |
251 | } | 251 | } |
252 | if (start != test_start && end != test_start + PAGE_CACHE_SIZE - 1) { | 252 | if (start != test_start && end != test_start + PAGE_SIZE - 1) { |
253 | test_msg("Expected start %Lu end %Lu, got start %Lu end %Lu\n", | 253 | test_msg("Expected start %Lu end %Lu, got start %Lu end %Lu\n", |
254 | test_start, test_start + PAGE_CACHE_SIZE - 1, start, | 254 | test_start, test_start + PAGE_SIZE - 1, start, |
255 | end); | 255 | end); |
256 | goto out_bits; | 256 | goto out_bits; |
257 | } | 257 | } |
@@ -265,7 +265,7 @@ out_bits: | |||
265 | clear_extent_bits(&tmp, 0, total_dirty - 1, (unsigned)-1, GFP_KERNEL); | 265 | clear_extent_bits(&tmp, 0, total_dirty - 1, (unsigned)-1, GFP_KERNEL); |
266 | out: | 266 | out: |
267 | if (locked_page) | 267 | if (locked_page) |
268 | page_cache_release(locked_page); | 268 | put_page(locked_page); |
269 | process_page_range(inode, 0, total_dirty - 1, | 269 | process_page_range(inode, 0, total_dirty - 1, |
270 | PROCESS_UNLOCK | PROCESS_RELEASE); | 270 | PROCESS_UNLOCK | PROCESS_RELEASE); |
271 | iput(inode); | 271 | iput(inode); |
@@ -298,9 +298,9 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb, | |||
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | } | 299 | } |
300 | 300 | ||
301 | bitmap_set(bitmap, (PAGE_CACHE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE, | 301 | bitmap_set(bitmap, (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE, |
302 | sizeof(long) * BITS_PER_BYTE); | 302 | sizeof(long) * BITS_PER_BYTE); |
303 | extent_buffer_bitmap_set(eb, PAGE_CACHE_SIZE - sizeof(long) / 2, 0, | 303 | extent_buffer_bitmap_set(eb, PAGE_SIZE - sizeof(long) / 2, 0, |
304 | sizeof(long) * BITS_PER_BYTE); | 304 | sizeof(long) * BITS_PER_BYTE); |
305 | if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) { | 305 | if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) { |
306 | test_msg("Setting straddling pages failed\n"); | 306 | test_msg("Setting straddling pages failed\n"); |
@@ -309,10 +309,10 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb, | |||
309 | 309 | ||
310 | bitmap_set(bitmap, 0, len * BITS_PER_BYTE); | 310 | bitmap_set(bitmap, 0, len * BITS_PER_BYTE); |
311 | bitmap_clear(bitmap, | 311 | bitmap_clear(bitmap, |
312 | (PAGE_CACHE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE, | 312 | (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE, |
313 | sizeof(long) * BITS_PER_BYTE); | 313 | sizeof(long) * BITS_PER_BYTE); |
314 | extent_buffer_bitmap_set(eb, 0, 0, len * BITS_PER_BYTE); | 314 | extent_buffer_bitmap_set(eb, 0, 0, len * BITS_PER_BYTE); |
315 | extent_buffer_bitmap_clear(eb, PAGE_CACHE_SIZE - sizeof(long) / 2, 0, | 315 | extent_buffer_bitmap_clear(eb, PAGE_SIZE - sizeof(long) / 2, 0, |
316 | sizeof(long) * BITS_PER_BYTE); | 316 | sizeof(long) * BITS_PER_BYTE); |
317 | if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) { | 317 | if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) { |
318 | test_msg("Clearing straddling pages failed\n"); | 318 | test_msg("Clearing straddling pages failed\n"); |
@@ -353,7 +353,7 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb, | |||
353 | 353 | ||
354 | static int test_eb_bitmaps(void) | 354 | static int test_eb_bitmaps(void) |
355 | { | 355 | { |
356 | unsigned long len = PAGE_CACHE_SIZE * 4; | 356 | unsigned long len = PAGE_SIZE * 4; |
357 | unsigned long *bitmap; | 357 | unsigned long *bitmap; |
358 | struct extent_buffer *eb; | 358 | struct extent_buffer *eb; |
359 | int ret; | 359 | int ret; |
@@ -379,7 +379,7 @@ static int test_eb_bitmaps(void) | |||
379 | 379 | ||
380 | /* Do it over again with an extent buffer which isn't page-aligned. */ | 380 | /* Do it over again with an extent buffer which isn't page-aligned. */ |
381 | free_extent_buffer(eb); | 381 | free_extent_buffer(eb); |
382 | eb = __alloc_dummy_extent_buffer(NULL, PAGE_CACHE_SIZE / 2, len); | 382 | eb = __alloc_dummy_extent_buffer(NULL, PAGE_SIZE / 2, len); |
383 | if (!eb) { | 383 | if (!eb) { |
384 | test_msg("Couldn't allocate test extent buffer\n"); | 384 | test_msg("Couldn't allocate test extent buffer\n"); |
385 | kfree(bitmap); | 385 | kfree(bitmap); |