X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=ctree.h;h=1fef37c93485f290c0a797af191ab35210b03d6c;hb=669ba89e52945e26528d498221c8ecd576b10d2d;hp=0e5c774c0d4df8127c1ce9702fed7d746c6a881b;hpb=3809b36d855fd13aad31c3a426a4d7434180003a;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/ctree.h b/ctree.h index 0e5c774..1fef37c 100644 --- a/ctree.h +++ b/ctree.h @@ -45,10 +45,12 @@ struct btrfs_free_space_ctl; #define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */ /* - * Fake signature for an unfinalized filesystem, structures might be partially - * created or missing. + * Fake signature for an unfinalized filesystem, which only has barebone tree + * structures (normally 6 near empty trees, on SINGLE meta/sys temporary chunks) + * + * ascii !BHRfS_M, no null */ -#define BTRFS_MAGIC_PARTIAL 0x4D5F536652484221ULL /* ascii !BHRfS_M, no null */ +#define BTRFS_MAGIC_TEMPORARY 0x4D5F536652484221ULL #define BTRFS_MAX_MIRRORS 3 @@ -167,10 +169,9 @@ struct btrfs_free_space_ctl; /* csum types */ #define BTRFS_CSUM_TYPE_CRC32 0 +/* four bytes for CRC32 */ static int btrfs_csum_sizes[] = { 4 }; -/* four bytes for CRC32 */ -#define BTRFS_CRC32_SIZE 4 #define BTRFS_EMPTY_DIR_SIZE 0 #define BTRFS_FT_UNKNOWN 0 @@ -359,13 +360,6 @@ struct btrfs_header { #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header)) #define BTRFS_LEAF_DATA_SIZE(fs_info) \ (__BTRFS_LEAF_DATA_SIZE(fs_info->nodesize)) -#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r->fs_info) - \ - sizeof(struct btrfs_item) - \ - sizeof(struct btrfs_file_extent_item)) -#define BTRFS_MAX_XATTR_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r->fs_info) - \ - sizeof(struct btrfs_item) -\ - sizeof(struct btrfs_dir_item)) - /* * this is a very generous portion of the super block, giving us @@ -965,7 +959,17 @@ struct btrfs_csum_item { #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7) #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8) #define BTRFS_BLOCK_GROUP_RESERVED BTRFS_AVAIL_ALLOC_BIT_SINGLE -#define BTRFS_NR_RAID_TYPES 7 + +enum btrfs_raid_types { + BTRFS_RAID_RAID10, + BTRFS_RAID_RAID1, + BTRFS_RAID_DUP, + BTRFS_RAID_RAID0, + BTRFS_RAID_SINGLE, + BTRFS_RAID_RAID5, + BTRFS_RAID_RAID6, + BTRFS_NR_RAID_TYPES +}; #define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \ BTRFS_BLOCK_GROUP_SYSTEM | \ @@ -1188,11 +1192,29 @@ struct btrfs_root { struct rb_node rb_node; }; +static inline u32 BTRFS_MAX_ITEM_SIZE(const struct btrfs_fs_info *info) +{ + return BTRFS_LEAF_DATA_SIZE(info) - sizeof(struct btrfs_item); +} + static inline u32 BTRFS_NODEPTRS_PER_BLOCK(const struct btrfs_fs_info *info) { return BTRFS_LEAF_DATA_SIZE(info) / sizeof(struct btrfs_key_ptr); } +#define BTRFS_FILE_EXTENT_INLINE_DATA_START \ + (offsetof(struct btrfs_file_extent_item, disk_bytenr)) +static inline u32 BTRFS_MAX_INLINE_DATA_SIZE(const struct btrfs_fs_info *info) +{ + return BTRFS_MAX_ITEM_SIZE(info) - + BTRFS_FILE_EXTENT_INLINE_DATA_START; +} + +static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_fs_info *info) +{ + return BTRFS_MAX_ITEM_SIZE(info) - sizeof(struct btrfs_dir_item); +} + /* * inode items have the data typically returned from stat and store other * info about object characteristics. There is one for every file and dir in @@ -1846,7 +1868,7 @@ static inline u32 btrfs_item_end_nr(struct extent_buffer *eb, int nr) return btrfs_item_end(eb, btrfs_item_nr(nr)); } -static inline u32 btrfs_item_offset_nr(struct extent_buffer *eb, int nr) +static inline u32 btrfs_item_offset_nr(const struct extent_buffer *eb, int nr) { return btrfs_item_offset(eb, btrfs_item_nr(nr)); } @@ -2490,12 +2512,6 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, u32 blocksize, u64 root_objectid, struct btrfs_disk_key *key, int level, u64 hint, u64 empty_size); -int btrfs_alloc_extent(struct btrfs_trans_handle *trans, - struct btrfs_root *root, - u64 num_bytes, u64 parent, - u64 root_objectid, u64 ref_generation, - u64 owner, u64 empty_size, u64 hint_byte, - u64 search_end, struct btrfs_key *ins, int data); int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, struct btrfs_root *root, u64 bytenr, u64 offset, int metadata, u64 *refs, u64 *flags); @@ -2648,7 +2664,8 @@ static inline int btrfs_next_item(struct btrfs_root *root, } int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path); -int btrfs_leaf_free_space(struct btrfs_root *root, struct extent_buffer *leaf); +int btrfs_leaf_free_space(struct btrfs_fs_info *fs_info, + struct extent_buffer *leaf); void btrfs_fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path, struct btrfs_disk_key *key, int level); int btrfs_set_item_key_safe(struct btrfs_root *root, struct btrfs_path *path,