btrfs-progs: convert: Fix inline file extent creation condition
[btrfs-progs-unstable/devel.git] / mkfs / common.h
blobf6b60c28a6027a8150c5a304f4793fd25efac97e
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public
4 * License v2 as published by the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 * General Public License for more details.
11 * You should have received a copy of the GNU General Public
12 * License along with this program; if not, write to the
13 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
14 * Boston, MA 021110-1307, USA.
18 * Defines and function declarations for users of the mkfs API, no internal
19 * defintions.
22 #ifndef __BTRFS_MKFS_COMMON_H__
23 #define __BTRFS_MKFS_COMMON_H__
25 #include "kerncompat.h"
26 #include "common-defs.h"
28 #define BTRFS_MKFS_SYSTEM_GROUP_SIZE SZ_4M
29 #define BTRFS_MKFS_SMALL_VOLUME_SIZE SZ_1G
32 * Tree root blocks created during mkfs
34 enum btrfs_mkfs_block {
35 MKFS_SUPER_BLOCK = 0,
36 MKFS_ROOT_TREE,
37 MKFS_EXTENT_TREE,
38 MKFS_CHUNK_TREE,
39 MKFS_DEV_TREE,
40 MKFS_FS_TREE,
41 MKFS_CSUM_TREE,
42 MKFS_BLOCK_COUNT
45 struct btrfs_mkfs_config {
46 /* Label of the new filesystem */
47 const char *label;
48 /* Blck sizes */
49 u32 nodesize;
50 u32 sectorsize;
51 u32 stripesize;
52 /* Bitfield of incompat features, BTRFS_FEATURE_INCOMPAT_* */
53 u64 features;
54 /* Size of the filesystem in bytes */
55 u64 num_bytes;
57 /* Output fields, set during creation */
59 /* Logical addresses of superblock [0] and other tree roots */
60 u64 blocks[MKFS_BLOCK_COUNT + 1];
61 char fs_uuid[BTRFS_UUID_UNPARSED_SIZE];
62 char chunk_uuid[BTRFS_UUID_UNPARSED_SIZE];
64 /* Superblock offset after make_btrfs */
65 u64 super_bytenr;
68 int make_btrfs(int fd, struct btrfs_mkfs_config *cfg);
69 u64 btrfs_min_dev_size(u32 nodesize, int mixed, u64 meta_profile,
70 u64 data_profile);
71 int test_minimum_size(const char *file, u64 min_dev_size);
72 int is_vol_small(const char *file);
73 int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
74 u64 dev_cnt, int mixed, int ssd);
75 int test_status_for_mkfs(const char *file, bool force_overwrite);
76 int test_dev_for_mkfs(const char *file, int force_overwrite);
78 #endif