btrfs-progs: do not merge tree block refs have different root_id
[btrfs-progs-unstable/devel.git] / image / metadump.h
blobb9275e95463e2650e09cae8f03d311324cb7d350
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.
17 #ifndef __BTRFS_IMAGE_METADUMP_H__
18 #define __BTRFS_IMAGE_METADUMP_H__
20 #include "kerncompat.h"
21 #include "kernel-lib/rbtree.h"
22 #include "kernel-lib/list.h"
23 #include "ctree.h"
25 #define HEADER_MAGIC 0xbd5c25e27295668bULL
26 #define MAX_PENDING_SIZE (256 * 1024)
27 #define BLOCK_SIZE 1024
28 #define BLOCK_MASK (BLOCK_SIZE - 1)
30 #define ITEMS_PER_CLUSTER ((BLOCK_SIZE - sizeof(struct meta_cluster)) / \
31 sizeof(struct meta_cluster_item))
33 #define COMPRESS_NONE 0
34 #define COMPRESS_ZLIB 1
36 struct meta_cluster_item {
37 __le64 bytenr;
38 __le32 size;
39 } __attribute__ ((__packed__));
41 struct meta_cluster_header {
42 __le64 magic;
43 __le64 bytenr;
44 __le32 nritems;
45 u8 compress;
46 } __attribute__ ((__packed__));
48 /* cluster header + index items + buffers */
49 struct meta_cluster {
50 struct meta_cluster_header header;
51 struct meta_cluster_item items[];
52 } __attribute__ ((__packed__));
54 struct fs_chunk {
55 u64 logical;
56 u64 physical;
58 * physical_dup only store additonal physical for BTRFS_BLOCK_GROUP_DUP
59 * currently restore only support single and DUP
60 * TODO: modify this structure and the function related to this
61 * structure for support RAID*
63 u64 physical_dup;
64 u64 bytes;
65 struct rb_node l;
66 struct rb_node p;
67 struct list_head list;
70 #endif