btrfs-progs: docs: add missing short option for qroup-report
[platform/upstream/btrfs-progs.git] / ctree.h
diff --git a/ctree.h b/ctree.h
index 7063048..48ae890 100644 (file)
--- a/ctree.h
+++ b/ctree.h
@@ -34,7 +34,7 @@
 #include <btrfs/extent-cache.h>
 #include <btrfs/extent_io.h>
 #include <btrfs/ioctl.h>
-#include <linux/sizes.h>
+#include <btrfs/sizes.h>
 #endif /* BTRFS_FLAT_INCLUDES */
 
 struct btrfs_root;
@@ -352,11 +352,11 @@ struct btrfs_header {
        u8 level;
 } __attribute__ ((__packed__));
 
-#define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->nodesize - \
+#define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->fs_info->nodesize - \
                                sizeof(struct btrfs_header)) / \
                                sizeof(struct btrfs_key_ptr))
 #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
-#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->nodesize))
+#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->fs_info->nodesize))
 #define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
                                        sizeof(struct btrfs_item) - \
                                        sizeof(struct btrfs_file_extent_item))
@@ -440,7 +440,7 @@ struct btrfs_super_block {
        __le32 sectorsize;
        __le32 nodesize;
        /* Unused and must be equal to nodesize */
-       __le32 leafsize;
+       __le32 __unused_leafsize;
        __le32 stripesize;
        __le32 sys_chunk_array_size;
        __le64 chunk_root_generation;
@@ -1147,6 +1147,10 @@ struct btrfs_fs_info {
        struct cache_tree *fsck_extent_cache;
        struct cache_tree *corrupt_blocks;
 
+       /* Cached block sizes */
+       u32 nodesize;
+       u32 sectorsize;
+       u32 stripesize;
 };
 
 /*
@@ -1162,18 +1166,6 @@ struct btrfs_root {
        u64 objectid;
        u64 last_trans;
 
-       /* data allocations are done in sectorsize units */
-       u32 sectorsize;
-
-       /* node allocations are done in nodesize units */
-       u32 nodesize;
-
-       /* Unused, equal to nodesize */
-       u32 leafsize;
-
-       /* leaf allocations are done in nodesize units */
-       u32 stripesize;
-
        int ref_cows;
        int track_dirty;
 
@@ -2039,33 +2031,12 @@ static inline unsigned long btrfs_header_chunk_tree_uuid(struct extent_buffer *e
        return offsetof(struct btrfs_header, chunk_tree_uuid);
 }
 
-static inline u8 *btrfs_super_fsid(struct extent_buffer *eb)
-{
-       unsigned long ptr = offsetof(struct btrfs_super_block, fsid);
-       return (u8 *)ptr;
-}
-
 static inline u8 *btrfs_header_csum(struct extent_buffer *eb)
 {
        unsigned long ptr = offsetof(struct btrfs_header, csum);
        return (u8 *)ptr;
 }
 
-static inline struct btrfs_node *btrfs_buffer_node(struct extent_buffer *eb)
-{
-       return NULL;
-}
-
-static inline struct btrfs_leaf *btrfs_buffer_leaf(struct extent_buffer *eb)
-{
-       return NULL;
-}
-
-static inline struct btrfs_header *btrfs_buffer_header(struct extent_buffer *eb)
-{
-       return NULL;
-}
-
 static inline int btrfs_is_leaf(struct extent_buffer *eb)
 {
        return (btrfs_header_level(eb) == 0);
@@ -2180,8 +2151,6 @@ BTRFS_SETGET_STACK_FUNCS(super_sectorsize, struct btrfs_super_block,
                         sectorsize, 32);
 BTRFS_SETGET_STACK_FUNCS(super_nodesize, struct btrfs_super_block,
                         nodesize, 32);
-BTRFS_SETGET_STACK_FUNCS(super_leafsize, struct btrfs_super_block,
-                        leafsize, 32);
 BTRFS_SETGET_STACK_FUNCS(super_stripesize, struct btrfs_super_block,
                         stripesize, 32);
 BTRFS_SETGET_STACK_FUNCS(super_root_dir, struct btrfs_super_block,
@@ -2431,17 +2400,6 @@ static inline u32 btrfs_file_extent_inline_len(struct extent_buffer *eb,
        return btrfs_file_extent_ram_bytes(eb, fi);
 }
 
-/*
- * NOTE: Backward compatibility, do not use.
- * Replacement: read nodesize directly
- */
-__attribute__((deprecated))
-static inline u32 btrfs_level_size(struct btrfs_root *root, int level) {
-       if (level == 0)
-               return root->leafsize;
-       return root->nodesize;
-}
-
 #define btrfs_fs_incompat(fs_info, opt) \
        __btrfs_fs_incompat((fs_info), BTRFS_FEATURE_INCOMPAT_##opt)
 
@@ -2540,11 +2498,11 @@ struct btrfs_block_group_cache *
 btrfs_add_block_group(struct btrfs_fs_info *fs_info, u64 bytes_used, u64 type,
                      u64 chunk_objectid, u64 chunk_offset, u64 size);
 int btrfs_make_block_group(struct btrfs_trans_handle *trans,
-                          struct btrfs_root *root, u64 bytes_used,
+                          struct btrfs_fs_info *fs_info, u64 bytes_used,
                           u64 type, u64 chunk_objectid, u64 chunk_offset,
                           u64 size);
 int btrfs_make_block_groups(struct btrfs_trans_handle *trans,
-                           struct btrfs_root *root);
+                           struct btrfs_fs_info *fs_info);
 int btrfs_update_block_group(struct btrfs_trans_handle *trans,
                             struct btrfs_root *root, u64 bytenr, u64 num,
                             int alloc, int mark_free);
@@ -2575,7 +2533,7 @@ btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
                 struct extent_buffer *buf);
 void reada_for_search(struct btrfs_root *root, struct btrfs_path *path,
                             int level, int slot, u64 objectid);
-struct extent_buffer *read_node_slot(struct btrfs_root *root,
+struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
                                   struct extent_buffer *parent, int slot);
 int btrfs_previous_item(struct btrfs_root *root,
                        struct btrfs_path *path, u64 min_objectid,
@@ -2734,7 +2692,7 @@ int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
 struct btrfs_inode_ref *btrfs_lookup_inode_ref(struct btrfs_trans_handle *trans,
                struct btrfs_root *root, struct btrfs_path *path,
                const char *name, int namelen, u64 ino, u64 parent_ino,
-               u64 index, int ins_len);
+               int ins_len);
 int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
                        struct btrfs_root *root, const char *name, int name_len,
                        u64 ino, u64 parent_ino, u64 *index);
@@ -2797,4 +2755,7 @@ int btrfs_get_extent(struct btrfs_trans_handle *trans,
 int btrfs_punch_hole(struct btrfs_trans_handle *trans,
                     struct btrfs_root *root,
                     u64 ino, u64 offset, u64 len);
+int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len,
+                   char *dest);
+
 #endif