hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/fs/btrfs/extent_map.h
....@@ -9,15 +9,23 @@
99 #define EXTENT_MAP_LAST_BYTE ((u64)-4)
1010 #define EXTENT_MAP_HOLE ((u64)-3)
1111 #define EXTENT_MAP_INLINE ((u64)-2)
12
+/* used only during fiemap calls */
1213 #define EXTENT_MAP_DELALLOC ((u64)-1)
1314
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
+};
2129
2230 struct extent_map {
2331 struct rb_node rb_node;
....@@ -34,22 +42,15 @@
3442 u64 block_len;
3543 u64 generation;
3644 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;
4647 refcount_t refs;
4748 unsigned int compress_type;
4849 struct list_head list;
4950 };
5051
5152 struct extent_map_tree {
52
- struct rb_root map;
53
+ struct rb_root_cached map;
5354 struct list_head modified_extents;
5455 rwlock_t lock;
5556 };
....@@ -78,7 +79,7 @@
7879 u64 start, u64 len);
7980 int add_extent_mapping(struct extent_map_tree *tree,
8081 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);
8283 void replace_extent_mapping(struct extent_map_tree *tree,
8384 struct extent_map *cur,
8485 struct extent_map *new,