Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Copyright (C) 2015 Facebook.  All rights reserved.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 4 */
 5
 6#ifndef BTRFS_FREE_SPACE_TREE_H
 7#define BTRFS_FREE_SPACE_TREE_H
 8
 9#include <linux/bits.h>
10
11struct btrfs_caching_control;
12struct btrfs_fs_info;
13struct btrfs_path;
14struct btrfs_block_group;
15struct btrfs_trans_handle;
16
17/*
18 * The default size for new free space bitmap items. The last bitmap in a block
19 * group may be truncated, and none of the free space tree code assumes that
20 * existing bitmaps are this size.
21 */
22#define BTRFS_FREE_SPACE_BITMAP_SIZE 256
23#define BTRFS_FREE_SPACE_BITMAP_BITS (BTRFS_FREE_SPACE_BITMAP_SIZE * BITS_PER_BYTE)
24
25void set_free_space_tree_thresholds(struct btrfs_block_group *block_group);
26int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info);
27int btrfs_delete_free_space_tree(struct btrfs_fs_info *fs_info);
28int btrfs_rebuild_free_space_tree(struct btrfs_fs_info *fs_info);
29int load_free_space_tree(struct btrfs_caching_control *caching_ctl);
30int add_block_group_free_space(struct btrfs_trans_handle *trans,
31			       struct btrfs_block_group *block_group);
 
32int remove_block_group_free_space(struct btrfs_trans_handle *trans,
33				  struct btrfs_block_group *block_group);
 
34int add_to_free_space_tree(struct btrfs_trans_handle *trans,
 
35			   u64 start, u64 size);
36int remove_from_free_space_tree(struct btrfs_trans_handle *trans,
 
37				u64 start, u64 size);
38
39#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
40struct btrfs_free_space_info *
41search_free_space_info(struct btrfs_trans_handle *trans,
42		       struct btrfs_block_group *block_group,
 
43		       struct btrfs_path *path, int cow);
44int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
45			     struct btrfs_block_group *block_group,
 
46			     struct btrfs_path *path, u64 start, u64 size);
47int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
48				  struct btrfs_block_group *block_group,
 
49				  struct btrfs_path *path, u64 start, u64 size);
50int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
51				  struct btrfs_block_group *block_group,
 
52				  struct btrfs_path *path);
53int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
54				  struct btrfs_block_group *block_group,
 
55				  struct btrfs_path *path);
56int free_space_test_bit(struct btrfs_block_group *block_group,
57			struct btrfs_path *path, u64 offset);
58#endif
59
60#endif
v4.10.11
 
 1/*
 2 * Copyright (C) 2015 Facebook.  All rights reserved.
 3 *
 4 * This program is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU General Public
 6 * License v2 as published by the Free Software Foundation.
 7 *
 8 * This program is distributed in the hope that it will be useful,
 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
17 */
18
19#ifndef __BTRFS_FREE_SPACE_TREE
20#define __BTRFS_FREE_SPACE_TREE
 
 
 
 
 
 
 
 
21
22/*
23 * The default size for new free space bitmap items. The last bitmap in a block
24 * group may be truncated, and none of the free space tree code assumes that
25 * existing bitmaps are this size.
26 */
27#define BTRFS_FREE_SPACE_BITMAP_SIZE 256
28#define BTRFS_FREE_SPACE_BITMAP_BITS (BTRFS_FREE_SPACE_BITMAP_SIZE * BITS_PER_BYTE)
29
30void set_free_space_tree_thresholds(struct btrfs_block_group_cache *block_group);
31int btrfs_create_free_space_tree(struct btrfs_fs_info *fs_info);
32int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info);
 
33int load_free_space_tree(struct btrfs_caching_control *caching_ctl);
34int add_block_group_free_space(struct btrfs_trans_handle *trans,
35			       struct btrfs_fs_info *fs_info,
36			       struct btrfs_block_group_cache *block_group);
37int remove_block_group_free_space(struct btrfs_trans_handle *trans,
38				  struct btrfs_fs_info *fs_info,
39				  struct btrfs_block_group_cache *block_group);
40int add_to_free_space_tree(struct btrfs_trans_handle *trans,
41			   struct btrfs_fs_info *fs_info,
42			   u64 start, u64 size);
43int remove_from_free_space_tree(struct btrfs_trans_handle *trans,
44				struct btrfs_fs_info *fs_info,
45				u64 start, u64 size);
46
47/* Exposed for testing. */
48struct btrfs_free_space_info *
49search_free_space_info(struct btrfs_trans_handle *trans,
50		       struct btrfs_fs_info *fs_info,
51		       struct btrfs_block_group_cache *block_group,
52		       struct btrfs_path *path, int cow);
53int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
54			     struct btrfs_fs_info *fs_info,
55			     struct btrfs_block_group_cache *block_group,
56			     struct btrfs_path *path, u64 start, u64 size);
57int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
58				  struct btrfs_fs_info *fs_info,
59				  struct btrfs_block_group_cache *block_group,
60				  struct btrfs_path *path, u64 start, u64 size);
61int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
62				  struct btrfs_fs_info *fs_info,
63				  struct btrfs_block_group_cache *block_group,
64				  struct btrfs_path *path);
65int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
66				  struct btrfs_fs_info *fs_info,
67				  struct btrfs_block_group_cache *block_group,
68				  struct btrfs_path *path);
69int free_space_test_bit(struct btrfs_block_group_cache *block_group,
70			struct btrfs_path *path, u64 offset);
 
71
72#endif