.. | .. |
---|
9 | 9 | #define EXTENT_MAP_LAST_BYTE ((u64)-4) |
---|
10 | 10 | #define EXTENT_MAP_HOLE ((u64)-3) |
---|
11 | 11 | #define EXTENT_MAP_INLINE ((u64)-2) |
---|
| 12 | +/* used only during fiemap calls */ |
---|
12 | 13 | #define EXTENT_MAP_DELALLOC ((u64)-1) |
---|
13 | 14 | |
---|
14 | | -/* bits for the flags field */ |
---|
15 | | -#define EXTENT_FLAG_PINNED 0 /* this entry not yet on disk, don't free it */ |
---|
16 | | -#define EXTENT_FLAG_COMPRESSED 1 |
---|
17 | | -#define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */ |
---|
18 | | -#define EXTENT_FLAG_LOGGING 4 /* Logging this extent */ |
---|
19 | | -#define EXTENT_FLAG_FILLING 5 /* Filling in a preallocated extent */ |
---|
20 | | -#define EXTENT_FLAG_FS_MAPPING 6 /* filesystem extent mapping type */ |
---|
| 15 | +/* bits for the extent_map::flags field */ |
---|
| 16 | +enum { |
---|
| 17 | + /* this entry not yet on disk, don't free it */ |
---|
| 18 | + EXTENT_FLAG_PINNED, |
---|
| 19 | + EXTENT_FLAG_COMPRESSED, |
---|
| 20 | + /* pre-allocated extent */ |
---|
| 21 | + EXTENT_FLAG_PREALLOC, |
---|
| 22 | + /* Logging this extent */ |
---|
| 23 | + EXTENT_FLAG_LOGGING, |
---|
| 24 | + /* Filling in a preallocated extent */ |
---|
| 25 | + EXTENT_FLAG_FILLING, |
---|
| 26 | + /* filesystem extent mapping type */ |
---|
| 27 | + EXTENT_FLAG_FS_MAPPING, |
---|
| 28 | +}; |
---|
21 | 29 | |
---|
22 | 30 | struct extent_map { |
---|
23 | 31 | struct rb_node rb_node; |
---|
.. | .. |
---|
34 | 42 | u64 block_len; |
---|
35 | 43 | u64 generation; |
---|
36 | 44 | unsigned long flags; |
---|
37 | | - union { |
---|
38 | | - struct block_device *bdev; |
---|
39 | | - |
---|
40 | | - /* |
---|
41 | | - * used for chunk mappings |
---|
42 | | - * flags & EXTENT_FLAG_FS_MAPPING must be set |
---|
43 | | - */ |
---|
44 | | - struct map_lookup *map_lookup; |
---|
45 | | - }; |
---|
| 45 | + /* Used for chunk mappings, flag EXTENT_FLAG_FS_MAPPING must be set */ |
---|
| 46 | + struct map_lookup *map_lookup; |
---|
46 | 47 | refcount_t refs; |
---|
47 | 48 | unsigned int compress_type; |
---|
48 | 49 | struct list_head list; |
---|
49 | 50 | }; |
---|
50 | 51 | |
---|
51 | 52 | struct extent_map_tree { |
---|
52 | | - struct rb_root map; |
---|
| 53 | + struct rb_root_cached map; |
---|
53 | 54 | struct list_head modified_extents; |
---|
54 | 55 | rwlock_t lock; |
---|
55 | 56 | }; |
---|
.. | .. |
---|
78 | 79 | u64 start, u64 len); |
---|
79 | 80 | int add_extent_mapping(struct extent_map_tree *tree, |
---|
80 | 81 | struct extent_map *em, int modified); |
---|
81 | | -int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em); |
---|
| 82 | +void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em); |
---|
82 | 83 | void replace_extent_mapping(struct extent_map_tree *tree, |
---|
83 | 84 | struct extent_map *cur, |
---|
84 | 85 | struct extent_map *new, |
---|