Lines Matching +full:1 +full:eb

17 #define PROCESS_UNLOCK		(1 << 0)
18 #define PROCESS_RELEASE (1 << 1)
19 #define PROCESS_TEST_LOCKED (1 << 2)
104 state->end + 1 - state->start, flags_str); in dump_extent_io_tree()
180 set_extent_bit(tmp, 0, sectorsize - 1, EXTENT_DELALLOC, NULL); in test_find_delalloc()
182 end = start + PAGE_SIZE - 1; in test_find_delalloc()
189 if (start != 0 || end != (sectorsize - 1)) { in test_find_delalloc()
191 sectorsize - 1, start, end); in test_find_delalloc()
211 set_extent_bit(tmp, sectorsize, max_bytes - 1, EXTENT_DELALLOC, NULL); in test_find_delalloc()
213 end = start + PAGE_SIZE - 1; in test_find_delalloc()
220 if (start != test_start || end != max_bytes - 1) { in test_find_delalloc()
222 test_start, max_bytes - 1, start, end); in test_find_delalloc()
247 end = start + PAGE_SIZE - 1; in test_find_delalloc()
254 if (end != test_start + PAGE_SIZE - 1) { in test_find_delalloc()
266 set_extent_bit(tmp, max_bytes, total_dirty - 1, EXTENT_DELALLOC, NULL); in test_find_delalloc()
268 end = start + PAGE_SIZE - 1; in test_find_delalloc()
275 if (start != test_start || end != total_dirty - 1) { in test_find_delalloc()
277 test_start, total_dirty - 1, start, end); in test_find_delalloc()
303 end = start + PAGE_SIZE - 1; in test_find_delalloc()
316 if (start != test_start && end != test_start + PAGE_SIZE - 1) { in test_find_delalloc()
318 test_start, test_start + PAGE_SIZE - 1, start, end); in test_find_delalloc()
330 clear_extent_bits(tmp, 0, total_dirty - 1, (unsigned)-1); in test_find_delalloc()
334 process_page_range(inode, 0, total_dirty - 1, in test_find_delalloc()
342 static int check_eb_bitmap(unsigned long *bitmap, struct extent_buffer *eb) in check_eb_bitmap() argument
346 for (i = 0; i < eb->len * BITS_PER_BYTE; i++) { in check_eb_bitmap()
350 bit1 = !!extent_buffer_test_bit(eb, 0, i); in check_eb_bitmap()
355 read_extent_buffer(eb, &has, i / BITS_PER_BYTE, 1); in check_eb_bitmap()
364 bit1 = !!extent_buffer_test_bit(eb, i / BITS_PER_BYTE, in check_eb_bitmap()
370 read_extent_buffer(eb, &has, i / BITS_PER_BYTE, 1); in check_eb_bitmap()
384 struct extent_buffer *eb, in test_bitmap_set() argument
391 extent_buffer_bitmap_set(eb, byte_start, bit_start, bit_len); in test_bitmap_set()
392 ret = check_eb_bitmap(bitmap, eb); in test_bitmap_set()
399 struct extent_buffer *eb, in test_bitmap_clear() argument
406 extent_buffer_bitmap_clear(eb, byte_start, bit_start, bit_len); in test_bitmap_clear()
407 ret = check_eb_bitmap(bitmap, eb); in test_bitmap_clear()
412 static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb) in __test_eb_bitmaps() argument
415 unsigned long byte_len = eb->len; in __test_eb_bitmaps()
419 ret = test_bitmap_clear("clear all run 1", bitmap, eb, 0, 0, in __test_eb_bitmaps()
424 ret = test_bitmap_set("set all", bitmap, eb, 0, 0, byte_len * BITS_PER_BYTE); in __test_eb_bitmaps()
428 ret = test_bitmap_clear("clear all run 2", bitmap, eb, 0, 0, in __test_eb_bitmaps()
433 ret = test_bitmap_set("same byte set", bitmap, eb, 0, 2, 4); in __test_eb_bitmaps()
437 ret = test_bitmap_clear("same byte partial clear", bitmap, eb, 0, 4, 1); in __test_eb_bitmaps()
441 ret = test_bitmap_set("cross byte set", bitmap, eb, 2, 4, 8); in __test_eb_bitmaps()
445 ret = test_bitmap_set("cross multi byte set", bitmap, eb, 4, 4, 24); in __test_eb_bitmaps()
449 ret = test_bitmap_clear("cross byte clear", bitmap, eb, 2, 6, 4); in __test_eb_bitmaps()
453 ret = test_bitmap_clear("cross multi byte clear", bitmap, eb, 4, 6, 20); in __test_eb_bitmaps()
459 ret = test_bitmap_set("cross page set", bitmap, eb, in __test_eb_bitmaps()
465 ret = test_bitmap_set("cross page set all", bitmap, eb, 0, 0, in __test_eb_bitmaps()
470 ret = test_bitmap_clear("cross page clear", bitmap, eb, in __test_eb_bitmaps()
482 ret = test_bitmap_clear("clear all run 3", bitmap, eb, 0, 0, in __test_eb_bitmaps()
490 if (x & (1U << j)) { in __test_eb_bitmaps()
491 bitmap_set(bitmap, i * 32 + j, 1); in __test_eb_bitmaps()
492 extent_buffer_bitmap_set(eb, 0, i * 32 + j, 1); in __test_eb_bitmaps()
497 ret = check_eb_bitmap(bitmap, eb); in __test_eb_bitmaps()
510 struct extent_buffer *eb = NULL; in test_eb_bitmaps() local
528 eb = __alloc_dummy_extent_buffer(fs_info, 0, nodesize); in test_eb_bitmaps()
529 if (!eb) { in test_eb_bitmaps()
535 ret = __test_eb_bitmaps(bitmap, eb); in test_eb_bitmaps()
539 free_extent_buffer(eb); in test_eb_bitmaps()
545 eb = __alloc_dummy_extent_buffer(fs_info, sectorsize, nodesize); in test_eb_bitmaps()
546 if (!eb) { in test_eb_bitmaps()
552 ret = __test_eb_bitmaps(bitmap, eb); in test_eb_bitmaps()
554 free_extent_buffer(eb); in test_eb_bitmaps()
572 if (start != 0 || end != -1) { in test_find_first_clear_extent_bit()
579 * Set 1M-4M alloc/discard and 32M-64M thus leaving a hole between in test_find_first_clear_extent_bit()
582 set_extent_bit(&tree, SZ_1M, SZ_4M - 1, in test_find_first_clear_extent_bit()
588 if (start != 0 || end != SZ_1M - 1) { in test_find_first_clear_extent_bit()
595 set_extent_bit(&tree, SZ_32M, SZ_64M - 1, in test_find_first_clear_extent_bit()
604 if (start != SZ_4M || end != SZ_32M - 1) { in test_find_first_clear_extent_bit()
617 if (start != SZ_4M || end != SZ_32M - 1) { in test_find_first_clear_extent_bit()
627 set_extent_bit(&tree, SZ_64M, SZ_64M + SZ_8M - 1, CHUNK_ALLOCATED, NULL); in test_find_first_clear_extent_bit()
631 if (start != SZ_64M || end != SZ_64M + SZ_8M - 1) { in test_find_first_clear_extent_bit()
644 if (start != SZ_64M || end != SZ_64M + SZ_8M - 1) { in test_find_first_clear_extent_bit()
652 * and end should be -1 in test_find_first_clear_extent_bit()
654 find_first_clear_extent_bit(&tree, -1, &start, &end, CHUNK_TRIMMED); in test_find_first_clear_extent_bit()
655 if (start != SZ_64M + SZ_8M || end != -1) { in test_find_first_clear_extent_bit()
666 clear_extent_bits(&tree, 0, (u64)-1, CHUNK_TRIMMED | CHUNK_ALLOCATED); in test_find_first_clear_extent_bit()
671 static void dump_eb_and_memory_contents(struct extent_buffer *eb, void *memory, in dump_eb_and_memory_contents() argument
674 for (int i = 0; i < eb->len; i++) { in dump_eb_and_memory_contents()
675 struct page *page = folio_page(eb->folios[i >> PAGE_SHIFT], 0); in dump_eb_and_memory_contents()
678 if (memcmp(addr, memory + i, 1) != 0) { in dump_eb_and_memory_contents()
680 test_err("eb and memory diffs at byte %u, eb has 0x%02x memory has 0x%02x", in dump_eb_and_memory_contents()
687 static int verify_eb_and_memory(struct extent_buffer *eb, void *memory, in verify_eb_and_memory() argument
690 for (int i = 0; i < (eb->len >> PAGE_SHIFT); i++) { in verify_eb_and_memory()
691 void *eb_addr = folio_address(eb->folios[i]); in verify_eb_and_memory()
694 dump_eb_and_memory_contents(eb, memory, test_name); in verify_eb_and_memory()
705 static void init_eb_and_memory(struct extent_buffer *eb, void *memory) in init_eb_and_memory() argument
707 get_random_bytes(memory, eb->len); in init_eb_and_memory()
708 write_extent_buffer(eb, memory, 0, eb->len); in init_eb_and_memory()
714 struct extent_buffer *eb = NULL; in test_eb_mem_ops() local
733 eb = __alloc_dummy_extent_buffer(fs_info, SZ_1M, nodesize); in test_eb_mem_ops()
734 if (!eb) { in test_eb_mem_ops()
740 init_eb_and_memory(eb, memory); in test_eb_mem_ops()
741 ret = verify_eb_and_memory(eb, memory, "full eb write"); in test_eb_mem_ops()
746 memcpy_extent_buffer(eb, 0, 16, 16); in test_eb_mem_ops()
747 ret = verify_eb_and_memory(eb, memory, "same page non-overlapping memcpy 1"); in test_eb_mem_ops()
752 memcpy_extent_buffer(eb, 0, 2048, 16); in test_eb_mem_ops()
753 ret = verify_eb_and_memory(eb, memory, "same page non-overlapping memcpy 2"); in test_eb_mem_ops()
757 memcpy_extent_buffer(eb, 0, 2048, 2048); in test_eb_mem_ops()
758 ret = verify_eb_and_memory(eb, memory, "same page non-overlapping memcpy 3"); in test_eb_mem_ops()
763 memmove_extent_buffer(eb, 512, 256, 512); in test_eb_mem_ops()
764 ret = verify_eb_and_memory(eb, memory, "same page overlapping memcpy 1"); in test_eb_mem_ops()
769 memmove_extent_buffer(eb, 2048, 512, 2048); in test_eb_mem_ops()
770 ret = verify_eb_and_memory(eb, memory, "same page overlapping memcpy 2"); in test_eb_mem_ops()
774 memmove_extent_buffer(eb, 512, 2048, 2048); in test_eb_mem_ops()
775 ret = verify_eb_and_memory(eb, memory, "same page overlapping memcpy 3"); in test_eb_mem_ops()
781 memcpy_extent_buffer(eb, 0, 4096 - 128, 256); in test_eb_mem_ops()
782 ret = verify_eb_and_memory(eb, memory, "cross page non-overlapping memcpy 1"); in test_eb_mem_ops()
787 memcpy_extent_buffer(eb, 4096 - 128, 4096 + 128, 256); in test_eb_mem_ops()
788 ret = verify_eb_and_memory(eb, memory, "cross page non-overlapping memcpy 2"); in test_eb_mem_ops()
793 memmove_extent_buffer(eb, 4096 - 128, 4096 - 64, 256); in test_eb_mem_ops()
794 ret = verify_eb_and_memory(eb, memory, "cross page overlapping memcpy 1"); in test_eb_mem_ops()
799 memmove_extent_buffer(eb, 4096 - 64, 4096 - 128, 256); in test_eb_mem_ops()
800 ret = verify_eb_and_memory(eb, memory, "cross page overlapping memcpy 2"); in test_eb_mem_ops()
805 free_extent_buffer(eb); in test_eb_mem_ops()