// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013 Fusion IO. All rights reserved. */ #include <linux/types.h> #include "btrfs-tests.h" #include "../ctree.h" #include "../btrfs_inode.h" #include "../disk-io.h" #include "../extent_io.h" #include "../volumes.h" #include "../compression.h" #include "../accessors.h" static void insert_extent(struct btrfs_root *root, u64 start, u64 len, u64 ram_bytes, u64 offset, u64 disk_bytenr, u64 disk_len, u32 type, u8 compression, int slot) { … } static void insert_inode_item_key(struct btrfs_root *root) { … } /* * Build the most complicated map of extents the earth has ever seen. We want * this so we can test all of the corner cases of btrfs_get_extent. Here is a * diagram of how the extents will look though this may not be possible we still * want to make sure everything acts normally (the last number is not inclusive) * * [0 - 6][ 6 - 4096 ][ 4096 - 4100][4100 - 8195][8195 - 12291] * [inline][hole but no extent][ hole ][ regular ][regular1 split] * * [12291 - 16387][16387 - 24579][24579 - 28675][ 28675 - 32771][32771 - 36867 ] * [ hole ][regular1 split][ prealloc ][ prealloc1 ][prealloc1 written] * * [36867 - 45059][45059 - 53251][53251 - 57347][57347 - 61443][61443- 69635] * [ prealloc1 ][ compressed ][ compressed1 ][ regular ][ compressed1] * * [69635-73731][ 73731 - 86019 ][86019-90115] * [ regular ][ hole but no extent][ regular ] */ static void setup_file_extents(struct btrfs_root *root, u32 sectorsize) { … } static u32 prealloc_only = …; static u32 compressed_only = …; static u32 vacancy_only = …; static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize) { … } static int test_hole_first(u32 sectorsize, u32 nodesize) { … } static int test_extent_accounting(u32 sectorsize, u32 nodesize) { … } int btrfs_test_inodes(u32 sectorsize, u32 nodesize) { … }