diff options
author | Jeff Mahoney <jeffm@suse.com> | 2016-06-15 09:22:56 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-12-06 16:06:58 +0100 |
commit | da17066c40472c2d6a1aab7bb0090c3d285531c9 (patch) | |
tree | f51910799ffea3bfe5af34d009a2967b9e99e6ad /fs/btrfs/tests/btrfs-tests.c | |
parent | f15376df0dc2b632eb689793a73d4adba8404987 (diff) | |
download | linux-da17066c40472c2d6a1aab7bb0090c3d285531c9.tar.gz linux-da17066c40472c2d6a1aab7bb0090c3d285531c9.tar.bz2 linux-da17066c40472c2d6a1aab7bb0090c3d285531c9.zip |
btrfs: pull node/sector/stripe sizes out of root and into fs_info
We track the node sizes per-root, but they never vary from the values
in the superblock. This patch messes with the 80-column style a bit,
but subsequent patches to factor out root->fs_info into a convenience
variable fix it up again.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tests/btrfs-tests.c')
-rw-r--r-- | fs/btrfs/tests/btrfs-tests.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c index bf62ad919a95..cfabeeb16368 100644 --- a/fs/btrfs/tests/btrfs-tests.c +++ b/fs/btrfs/tests/btrfs-tests.c @@ -79,7 +79,7 @@ static void btrfs_destroy_test_fs(void) unregister_filesystem(&test_type); } -struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(void) +struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize) { struct btrfs_fs_info *fs_info = kzalloc(sizeof(struct btrfs_fs_info), GFP_KERNEL); @@ -100,6 +100,9 @@ struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(void) return NULL; } + fs_info->nodesize = nodesize; + fs_info->sectorsize = sectorsize; + if (init_srcu_struct(&fs_info->subvol_srcu)) { kfree(fs_info->fs_devices); kfree(fs_info->super_copy); @@ -189,7 +192,8 @@ void btrfs_free_dummy_root(struct btrfs_root *root) } struct btrfs_block_group_cache * -btrfs_alloc_dummy_block_group(unsigned long length, u32 sectorsize) +btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info, + unsigned long length) { struct btrfs_block_group_cache *cache; @@ -206,8 +210,9 @@ btrfs_alloc_dummy_block_group(unsigned long length, u32 sectorsize) cache->key.objectid = 0; cache->key.offset = length; cache->key.type = BTRFS_BLOCK_GROUP_ITEM_KEY; - cache->sectorsize = sectorsize; - cache->full_stripe_len = sectorsize; + cache->sectorsize = fs_info->sectorsize; + cache->full_stripe_len = fs_info->sectorsize; + cache->fs_info = fs_info; INIT_LIST_HEAD(&cache->list); INIT_LIST_HEAD(&cache->cluster_list); |