Lines Matching refs:ret
22 int ret = 0; in test_extents() local
27 ret = btrfs_add_free_space(cache, 0, SZ_4M); in test_extents()
28 if (ret) { in test_extents()
29 test_err("error adding initial extents %d", ret); in test_extents()
30 return ret; in test_extents()
33 ret = btrfs_remove_free_space(cache, 0, SZ_4M); in test_extents()
34 if (ret) { in test_extents()
35 test_err("error removing extent %d", ret); in test_extents()
36 return ret; in test_extents()
45 ret = btrfs_add_free_space(cache, 0, SZ_4M); in test_extents()
46 if (ret) { in test_extents()
47 test_err("error adding half extent %d", ret); in test_extents()
48 return ret; in test_extents()
51 ret = btrfs_remove_free_space(cache, 3 * SZ_1M, SZ_1M); in test_extents()
52 if (ret) { in test_extents()
53 test_err("error removing tail end %d", ret); in test_extents()
54 return ret; in test_extents()
57 ret = btrfs_remove_free_space(cache, 0, SZ_1M); in test_extents()
58 if (ret) { in test_extents()
59 test_err("error removing front end %d", ret); in test_extents()
60 return ret; in test_extents()
63 ret = btrfs_remove_free_space(cache, SZ_2M, 4096); in test_extents()
64 if (ret) { in test_extents()
65 test_err("error removing middle piece %d", ret); in test_extents()
66 return ret; in test_extents()
93 int ret; in test_bitmaps() local
97 ret = test_add_free_space_entry(cache, 0, SZ_4M, 1); in test_bitmaps()
98 if (ret) { in test_bitmaps()
99 test_err("couldn't create a bitmap entry %d", ret); in test_bitmaps()
100 return ret; in test_bitmaps()
103 ret = btrfs_remove_free_space(cache, 0, SZ_4M); in test_bitmaps()
104 if (ret) { in test_bitmaps()
105 test_err("error removing bitmap full range %d", ret); in test_bitmaps()
106 return ret; in test_bitmaps()
114 ret = test_add_free_space_entry(cache, 0, SZ_4M, 1); in test_bitmaps()
115 if (ret) { in test_bitmaps()
116 test_err("couldn't add to our bitmap entry %d", ret); in test_bitmaps()
117 return ret; in test_bitmaps()
120 ret = btrfs_remove_free_space(cache, SZ_1M, SZ_2M); in test_bitmaps()
121 if (ret) { in test_bitmaps()
122 test_err("couldn't remove middle chunk %d", ret); in test_bitmaps()
123 return ret; in test_bitmaps()
133 ret = test_add_free_space_entry(cache, next_bitmap_offset - SZ_2M, in test_bitmaps()
135 if (ret) { in test_bitmaps()
137 ret); in test_bitmaps()
138 return ret; in test_bitmaps()
141 ret = btrfs_remove_free_space(cache, next_bitmap_offset - SZ_1M, SZ_2M); in test_bitmaps()
142 if (ret) { in test_bitmaps()
143 test_err("couldn't remove overlapping space %d", ret); in test_bitmaps()
144 return ret; in test_bitmaps()
162 int ret; in test_bitmaps_and_extents() local
171 ret = test_add_free_space_entry(cache, SZ_4M, SZ_1M, 1); in test_bitmaps_and_extents()
172 if (ret) { in test_bitmaps_and_extents()
173 test_err("couldn't create bitmap entry %d", ret); in test_bitmaps_and_extents()
174 return ret; in test_bitmaps_and_extents()
177 ret = test_add_free_space_entry(cache, 0, SZ_1M, 0); in test_bitmaps_and_extents()
178 if (ret) { in test_bitmaps_and_extents()
179 test_err("couldn't add extent entry %d", ret); in test_bitmaps_and_extents()
180 return ret; in test_bitmaps_and_extents()
183 ret = btrfs_remove_free_space(cache, 0, SZ_1M); in test_bitmaps_and_extents()
184 if (ret) { in test_bitmaps_and_extents()
185 test_err("couldn't remove extent entry %d", ret); in test_bitmaps_and_extents()
186 return ret; in test_bitmaps_and_extents()
195 ret = test_add_free_space_entry(cache, 0, SZ_1M, 0); in test_bitmaps_and_extents()
196 if (ret) { in test_bitmaps_and_extents()
197 test_err("couldn't re-add extent entry %d", ret); in test_bitmaps_and_extents()
198 return ret; in test_bitmaps_and_extents()
201 ret = btrfs_remove_free_space(cache, SZ_4M, SZ_1M); in test_bitmaps_and_extents()
202 if (ret) { in test_bitmaps_and_extents()
203 test_err("couldn't remove from bitmap %d", ret); in test_bitmaps_and_extents()
204 return ret; in test_bitmaps_and_extents()
216 ret = test_add_free_space_entry(cache, SZ_1M, SZ_4M, 1); in test_bitmaps_and_extents()
217 if (ret) { in test_bitmaps_and_extents()
218 test_err("couldn't add to a bitmap %d", ret); in test_bitmaps_and_extents()
219 return ret; in test_bitmaps_and_extents()
222 ret = btrfs_remove_free_space(cache, SZ_512K, 3 * SZ_1M); in test_bitmaps_and_extents()
223 if (ret) { in test_bitmaps_and_extents()
224 test_err("couldn't remove overlapping space %d", ret); in test_bitmaps_and_extents()
225 return ret; in test_bitmaps_and_extents()
236 ret = test_add_free_space_entry(cache, SZ_4M, SZ_4M, 1); in test_bitmaps_and_extents()
237 if (ret) { in test_bitmaps_and_extents()
238 test_err("couldn't add space to the bitmap %d", ret); in test_bitmaps_and_extents()
239 return ret; in test_bitmaps_and_extents()
242 ret = test_add_free_space_entry(cache, SZ_2M, SZ_2M, 0); in test_bitmaps_and_extents()
243 if (ret) { in test_bitmaps_and_extents()
244 test_err("couldn't add extent to the cache %d", ret); in test_bitmaps_and_extents()
245 return ret; in test_bitmaps_and_extents()
248 ret = btrfs_remove_free_space(cache, 3 * SZ_1M, SZ_4M); in test_bitmaps_and_extents()
249 if (ret) { in test_bitmaps_and_extents()
250 test_err("problem removing overlapping space %d", ret); in test_bitmaps_and_extents()
251 return ret; in test_bitmaps_and_extents()
270 ret = test_add_free_space_entry(cache, bitmap_offset + SZ_4M, SZ_4M, 1); in test_bitmaps_and_extents()
271 if (ret) { in test_bitmaps_and_extents()
272 test_err("couldn't add bitmap %d", ret); in test_bitmaps_and_extents()
273 return ret; in test_bitmaps_and_extents()
276 ret = test_add_free_space_entry(cache, bitmap_offset - SZ_1M, in test_bitmaps_and_extents()
278 if (ret) { in test_bitmaps_and_extents()
279 test_err("couldn't add extent entry %d", ret); in test_bitmaps_and_extents()
280 return ret; in test_bitmaps_and_extents()
283 ret = btrfs_remove_free_space(cache, bitmap_offset + SZ_1M, 5 * SZ_1M); in test_bitmaps_and_extents()
284 if (ret) { in test_bitmaps_and_extents()
285 test_err("failed to free our space %d", ret); in test_bitmaps_and_extents()
286 return ret; in test_bitmaps_and_extents()
302 ret = test_add_free_space_entry(cache, SZ_1M, SZ_2M, 1); in test_bitmaps_and_extents()
303 if (ret) { in test_bitmaps_and_extents()
304 test_err("couldn't add bitmap entry %d", ret); in test_bitmaps_and_extents()
305 return ret; in test_bitmaps_and_extents()
308 ret = test_add_free_space_entry(cache, 3 * SZ_1M, SZ_1M, 0); in test_bitmaps_and_extents()
309 if (ret) { in test_bitmaps_and_extents()
310 test_err("couldn't add extent entry %d", ret); in test_bitmaps_and_extents()
311 return ret; in test_bitmaps_and_extents()
314 ret = btrfs_remove_free_space(cache, SZ_1M, 3 * SZ_1M); in test_bitmaps_and_extents()
315 if (ret) { in test_bitmaps_and_extents()
316 test_err("error removing bitmap and extent overlapping %d", ret); in test_bitmaps_and_extents()
317 return ret; in test_bitmaps_and_extents()
398 int ret; in test_steal_space_from_bitmap_to_extent() local
432 ret = test_add_free_space_entry(cache, SZ_128M - SZ_256K, SZ_128K, 0); in test_steal_space_from_bitmap_to_extent()
433 if (ret) { in test_steal_space_from_bitmap_to_extent()
434 test_err("couldn't add extent entry %d", ret); in test_steal_space_from_bitmap_to_extent()
435 return ret; in test_steal_space_from_bitmap_to_extent()
439 ret = test_add_free_space_entry(cache, SZ_128M + SZ_512K, in test_steal_space_from_bitmap_to_extent()
441 if (ret) { in test_steal_space_from_bitmap_to_extent()
442 test_err("couldn't add bitmap entry %d", ret); in test_steal_space_from_bitmap_to_extent()
443 return ret; in test_steal_space_from_bitmap_to_extent()
446 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
447 if (ret) in test_steal_space_from_bitmap_to_extent()
448 return ret; in test_steal_space_from_bitmap_to_extent()
457 ret = btrfs_remove_free_space(cache, in test_steal_space_from_bitmap_to_extent()
460 if (ret) { in test_steal_space_from_bitmap_to_extent()
461 test_err("failed to free part of bitmap space %d", ret); in test_steal_space_from_bitmap_to_extent()
462 return ret; in test_steal_space_from_bitmap_to_extent()
508 ret = btrfs_add_free_space(cache, SZ_128M, SZ_512K); in test_steal_space_from_bitmap_to_extent()
509 if (ret) { in test_steal_space_from_bitmap_to_extent()
510 test_err("error adding free space: %d", ret); in test_steal_space_from_bitmap_to_extent()
511 return ret; in test_steal_space_from_bitmap_to_extent()
523 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
524 if (ret) in test_steal_space_from_bitmap_to_extent()
525 return ret; in test_steal_space_from_bitmap_to_extent()
533 ret = btrfs_add_free_space(cache, SZ_128M + SZ_16M, sectorsize); in test_steal_space_from_bitmap_to_extent()
534 if (ret) { in test_steal_space_from_bitmap_to_extent()
535 test_err("error adding free space: %d", ret); in test_steal_space_from_bitmap_to_extent()
536 return ret; in test_steal_space_from_bitmap_to_extent()
543 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
544 if (ret) in test_steal_space_from_bitmap_to_extent()
545 return ret; in test_steal_space_from_bitmap_to_extent()
552 ret = btrfs_add_free_space(cache, SZ_128M - SZ_128K, SZ_128K); in test_steal_space_from_bitmap_to_extent()
553 if (ret) { in test_steal_space_from_bitmap_to_extent()
554 test_err("error adding free space: %d", ret); in test_steal_space_from_bitmap_to_extent()
555 return ret; in test_steal_space_from_bitmap_to_extent()
567 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
568 if (ret) in test_steal_space_from_bitmap_to_extent()
569 return ret; in test_steal_space_from_bitmap_to_extent()
610 ret = check_num_extents_and_bitmaps(cache, 1, 1); in test_steal_space_from_bitmap_to_extent()
611 if (ret) in test_steal_space_from_bitmap_to_extent()
612 return ret; in test_steal_space_from_bitmap_to_extent()
628 ret = check_cache_empty(cache); in test_steal_space_from_bitmap_to_extent()
629 if (ret) in test_steal_space_from_bitmap_to_extent()
630 return ret; in test_steal_space_from_bitmap_to_extent()
643 ret = test_add_free_space_entry(cache, SZ_128M + SZ_128K, SZ_128K, 0); in test_steal_space_from_bitmap_to_extent()
644 if (ret) { in test_steal_space_from_bitmap_to_extent()
645 test_err("couldn't add extent entry %d", ret); in test_steal_space_from_bitmap_to_extent()
646 return ret; in test_steal_space_from_bitmap_to_extent()
650 ret = test_add_free_space_entry(cache, 0, SZ_128M - SZ_512K, 1); in test_steal_space_from_bitmap_to_extent()
651 if (ret) { in test_steal_space_from_bitmap_to_extent()
652 test_err("couldn't add bitmap entry %d", ret); in test_steal_space_from_bitmap_to_extent()
653 return ret; in test_steal_space_from_bitmap_to_extent()
656 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
657 if (ret) in test_steal_space_from_bitmap_to_extent()
658 return ret; in test_steal_space_from_bitmap_to_extent()
667 ret = btrfs_remove_free_space(cache, 0, SZ_128M - 768 * SZ_1K); in test_steal_space_from_bitmap_to_extent()
668 if (ret) { in test_steal_space_from_bitmap_to_extent()
669 test_err("failed to free part of bitmap space %d", ret); in test_steal_space_from_bitmap_to_extent()
670 return ret; in test_steal_space_from_bitmap_to_extent()
706 ret = btrfs_add_free_space(cache, SZ_128M - SZ_512K, SZ_512K); in test_steal_space_from_bitmap_to_extent()
707 if (ret) { in test_steal_space_from_bitmap_to_extent()
708 test_err("error adding free space: %d", ret); in test_steal_space_from_bitmap_to_extent()
709 return ret; in test_steal_space_from_bitmap_to_extent()
721 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
722 if (ret) in test_steal_space_from_bitmap_to_extent()
723 return ret; in test_steal_space_from_bitmap_to_extent()
731 ret = btrfs_add_free_space(cache, SZ_32M, 2 * sectorsize); in test_steal_space_from_bitmap_to_extent()
732 if (ret) { in test_steal_space_from_bitmap_to_extent()
733 test_err("error adding free space: %d", ret); in test_steal_space_from_bitmap_to_extent()
734 return ret; in test_steal_space_from_bitmap_to_extent()
742 ret = btrfs_add_free_space(cache, SZ_128M, SZ_128K); in test_steal_space_from_bitmap_to_extent()
743 if (ret) { in test_steal_space_from_bitmap_to_extent()
744 test_err("error adding free space: %d", ret); in test_steal_space_from_bitmap_to_extent()
745 return ret; in test_steal_space_from_bitmap_to_extent()
757 ret = check_num_extents_and_bitmaps(cache, 2, 1); in test_steal_space_from_bitmap_to_extent()
758 if (ret) in test_steal_space_from_bitmap_to_extent()
759 return ret; in test_steal_space_from_bitmap_to_extent()
799 ret = check_num_extents_and_bitmaps(cache, 1, 1); in test_steal_space_from_bitmap_to_extent()
800 if (ret) in test_steal_space_from_bitmap_to_extent()
801 return ret; in test_steal_space_from_bitmap_to_extent()
817 ret = check_cache_empty(cache); in test_steal_space_from_bitmap_to_extent()
818 if (ret) in test_steal_space_from_bitmap_to_extent()
819 return ret; in test_steal_space_from_bitmap_to_extent()
843 int ret, i; in test_bytes_index() local
851 ret = test_add_free_space_entry(cache, offset, bytes, 0); in test_bytes_index()
852 if (ret) { in test_bytes_index()
853 test_err("couldn't add extent entry %d\n", ret); in test_bytes_index()
854 return ret; in test_bytes_index()
875 ret = test_add_free_space_entry(cache, offset, bytes, 1); in test_bytes_index()
876 if (ret) { in test_bytes_index()
878 return ret; in test_bytes_index()
898 ret = test_add_free_space_entry(cache, 0, sectorsize, 1); in test_bytes_index()
899 if (ret) { in test_bytes_index()
901 return ret; in test_bytes_index()
905 ret = test_add_free_space_entry(cache, offset, sectorsize, 1); in test_bytes_index()
906 if (ret) { in test_bytes_index()
908 return ret; in test_bytes_index()
917 ret = btrfs_add_free_space(cache, offset, sectorsize); in test_bytes_index()
918 if (ret) { in test_bytes_index()
919 test_err("error populating sparse bitmap %d", ret); in test_bytes_index()
920 return ret; in test_bytes_index()
929 ret = btrfs_add_free_space(cache, offset, sectorsize); in test_bytes_index()
930 if (ret) { in test_bytes_index()
931 test_err("error adding contiguous extent %d", ret); in test_bytes_index()
932 return ret; in test_bytes_index()
973 ret = btrfs_add_free_space(cache, offset, sectorsize); in test_bytes_index()
974 if (ret) { in test_bytes_index()
975 test_err("error adding extent to the sparse entry %d", ret); in test_bytes_index()
976 return ret; in test_bytes_index()
1010 int ret = -ENOMEM; in btrfs_test_free_space_cache() local
1035 ret = PTR_ERR(root); in btrfs_test_free_space_cache()
1044 ret = test_extents(cache); in btrfs_test_free_space_cache()
1045 if (ret) in btrfs_test_free_space_cache()
1047 ret = test_bitmaps(cache, sectorsize); in btrfs_test_free_space_cache()
1048 if (ret) in btrfs_test_free_space_cache()
1050 ret = test_bitmaps_and_extents(cache, sectorsize); in btrfs_test_free_space_cache()
1051 if (ret) in btrfs_test_free_space_cache()
1054 ret = test_steal_space_from_bitmap_to_extent(cache, sectorsize); in btrfs_test_free_space_cache()
1055 if (ret) in btrfs_test_free_space_cache()
1057 ret = test_bytes_index(cache, sectorsize); in btrfs_test_free_space_cache()
1062 return ret; in btrfs_test_free_space_cache()